It basically contains all the points of our course and homework.
Feel free to copy or clone it.
It may have some algorithm problems, and I'll share my solution of them.
And some solution of problems on leet code.
Some OS questions.
- Introduction.
- Linear List.
- Stack and Queue.
- String
- General List, Arrays and Sparse Matrix
- Tree
- Graph
In the chapter3 we define the stack and queue, using the macro ELEMENT_TYPE
to announce the type of elements in the data struct.
However in some conditions, this method would cause fatal problems(I actually suffer from this, especially when I'm trying to reuse the struct).
Since I'm using only one macro to tell the type, when using two struct of different type, they will overcover each other.
So one method is make the elements all pointer and using a new macro to get element of right type.
Such as:
#ifndef ELEM
#define ELEM
typedef void* ELEMENT_TYPE;
#endif
#define TYPE_MACRO int
When ELEMENT_TYPE
is defined void*
, it's possible to reuse it.
However we'd use the new structure to contain new element.
So we make compromise that, we would redefine a existing structure to implement the new one.
In the first of some data struct, the is some drawback in it.
For some getter type functions, the returns should be the variables but not the "return". The return should deliver the function is finished or not, with bool type.
In chapter 6, and after this problem is solved.
We'd define all the functions with return type bool, the returns should be in the parameter.
Let's see an example:
// old defination, in the chapter 3
ELEMENT_TYPE DeQueue_Sq(psqQue sq);
// after change the method, in the chapter 6
bool _tree_que_de(_tQue tar, tNode* container);
Finally I'd wrap all the data structure with C namespace.
Actually C doesn't have namespace, but we could use the struct to imitate it.
For each Chapter, I'd write a .md file to illustrate the questions of this chapter.
And in some chapter may have my class note.
What's more it may contain my experiment report(the class required.)
My code may be not that good, but I' m looking to improvement.
And I'm glad to share my understanding of this art and make some friends.
This Project already ended.
For me, it's badly formatted and not work the best on some scene. However I hope this repo could help any starter who like me at that time to quickly grow up.