40 likes | 134 Views
summary labs. The subjects we take it in the labs until now it was example about data structure*: linked list: you can add and delete the node from head and tail ,also you can delete specific node in your liked list . Stack: you can add and delete node from head (push, pop)
E N D
summary labs nora albabtin
The subjects we take it in the labs until now it was example about data structure*: linked list: you can add and delete the node from head and tail ,also you can delete specific node in your liked list . Stack: you can add and delete node from head (push, pop) Queue: you can add node from tail and delete node from head(enqueue, dequeue) *Data Structure is an arrangement of data in a computer’s memory (or sometimes on a disk). Data structures include linked lists, arry , stacks, binary trees, and hash tables. nora albabtin
Data Structure linked list • Stack • Queue Class for create the node or item (materials) witch contain : Data(info) Pointer(next) In this class you need to write in the Public: 1-Constructor function for node. 2-define data variable 3-define Next pointer Note : any pointer you want to use it in your program it must be from type this class. • all of them need two classes to executed in c++ program • Class for operations or function • (Manpower)which use it to manipulate the node . In this class you need to write in the : 1- Public: define the Constructor function and here give the head and tail initial value (0) and any pointer you want to use it as public. And then write all the functions you want to use it in your program for example add, delete and any function whether basic function which existing in your slides or functions which have new idea from your teacher . 2- Private: define tail and head and any pointer you want to be public in your program like counter . nora albabtin
Notes : • Any pointer you want to define in your program whether as a public or inside any function(private) you must define it from type class node(first class) . • Any operation you need to apply it for all the nodes (items) you must use a pointer define it from class node and give it initial value (pointer =head), Then use it in the while or for loop ,the condition must be (pointer !=0)to pass until up the last item which it`s point to 0 . nora albabtin