![]() |
|||||||||
|
|
|||||||||
|
|||||
![]() والله يوم شفت بعض الأسئلة تذكرت المادة .. وتذكرت أمثلة زي كذا أخذناها ![]() امممممممم فيه أسئلة اختبارات سابقة للي حاب يطلّع عليها ... موجودة على هذا الرابط اضغط هنا بعد تحميل الملف المضغوط ، فيه أكثر من نموذج ، فيه في أحد النماذج سؤال قوي جدا ً ![]() السؤال نظري ولكنه جميل .... تعالوا نشوفه مع بعض :![]() (( اضغط على الصورة للتكبير )) ---------- اختبار الأولاد على حد علمي إنه يوم الخميس هذا ![]() بالتوفيق للجميع ،، |
|
|||||
|
مــــــــــــــــــــــــ ـــــهـــــــــــــــــــ ـــــــــــــــــم
مشكورة أختي و في ميزان حسناتك ان شاء الله ![]() بس في حاجة مهمة عشان الاختبار و هي: طباعة الــ Spcifications من موقع المادة!!! لأن ADT graph و ADT table أضيفوا! رجاءً تبلغوا الجميع ![]() و للفائدة..جربوا تسوو SORT للآتي: G1 M1 G2 C B M2 A بجميع أنواع الـ SORTING اللي درسناها. بحيث G1=G2 و M1=M2 و ركزوا على الـ Heap Sort في هذا المثال و ارجعوا للـ Algorithm الموجود في الكتاب. و قبل ما أنسى..اعرفوا الفروق بين الأنواع الأربعة لأن ممكن يجي سؤال نختار فيه أحسن نوع تبعا للحالة المعطاة.. و تحياتي.. |
|
||||
|
انا برضو شيكت بس حصلت القديمه
![]() شكرا رود .. ![]() --------------------------------------- بالنسبه لأسئلة الأولاد .. فيه اشياء مو معانا ![]() --------------------------------------- و بالنسبه لجزء القراف .... اكثر شي يجيبون ... depth-first , breadth-fisrt و لل network كثير جا ال Dijkstra's algorithm >>> عليه اسم ![]() --------------------------------------- |
|
||||
|
بنات فيه سؤال جا مره بالفاينال من زمان ..
شركه الاتصالات السعوديه (( يا كرهي لها )) تبغى تسوي دايكتوري لمدينه الرياض .. فيه اسم الشخص و العنوان و رقم التليفون .. و الهدف ان البحث عن اي شخص يكون سريييع .. و قالك ما فيه انسرشن و دليشن كثير >>> يعني AVL المهم ... الشركه تبغى البحث يكون اسرع ما يمكن فقالوا .. بيكون اول البحث عن شخص عن طريق الحرف الاول من الاسم بعدين .. ندور على نفس الاسم ... المطلوب ... ايش الاي دي تي المناسب ؟ اكتبي الاو\بريشن سييرتش (بحث ) طبعا عن طريق الاسم .. انسرت و دليت .. ((الاسماء لا تتكرر )) اطبعي الاشخاص اللي رقم التليفون حقهم يبدا ب "467" .. قالك في الاخير ... اذا الشركه تبغى تسوي الدايركتوري للممكله كلها ... ايش التغيير اللي بيصير في الا ADT المختار ؟؟؟ الجواب B-tree >>> ليه ؟ ... ما ادري اتوقع لأنها هييووج داتا ![]() الله يوفق الجميع ... (( معليش بسرررعه كتبت و ما شرحت زين ان شاء الله تفهمون ))شوفو الشكل كيف بيكون ... تري جوا تري >>> |
|
||||
|
و الله ذا الموضوع ما فيه الا أنا ![]() >>>> ![]() ![]() ![]() المهم ...[align=center]بنات السبيسيفكيشن الجديده نزلت ...[/align] >>> صح النوم صراحه .. المشكلة بكر االاختبار ![]() http://www.motken.com/csc211/ [line] [align=left]Second Semester 1424-1425/2004 CSC 211 : Data Structures in C++ This is the specification for the final exam. You should print it and bring it with you for the final exam. Please inform all your frinds that they should bring this specification to the exam. #include "el_t.h" typedef int index_t; typedef unsigned int count_t; // class definition for stack ADT class stack { public: stack(); // stack constructor ~stack(); // stack destructor bool StackIsEmpty (void); // is stack empty? bool StackIsFull (void); // is stack full? void Push (el_t); // push item void Pop (el_t&); // pop top item private: void StackError(char*); // error handler index_t top; // top index; -1 if empty el_t el[MAX_NUM_ELS]; // container for elements }; // class definition for queue ADT class queue { public: queue (void ); // default constructor ~queue (void ); // default destructor bool QueueIsEmpty (void ); // is queue empty? bool QueueIsFull (void ); // is queue full? void EnQueue (el_t ); // enqueue item void DeQueue (el_t&); // dequeue item el_t RetrieveQueue(void ); // retrieve front item protected: void QueueError(char*); // error handler index_t front; // front index index_t rear; // rear index count_t count; // number of elements el_t el[ QUEUE_SIZE ]; // container for elements }; #include "el_t.h" typedef struct node_t* pointer_t; struct node_t { el_t el; pointer_t next; }; // class definition for list ADT class list { public: // List constructor and destructor list(void); ~list(void); // Methods that manipulate list nodes void StoreInfo(el_t); el_t RetrieveInfo(void); el_t RetrieveNextInfo(void); // Methods that manipulate the list void Insert(el_t); void InsertAfter(el_t); void Delete(void); // Methods that traverse the list void ToFirst(void); void Advance(void); // Methods that test for certain conditions bool AtFirst(void); bool AtEnd(void); bool ListIsEmpty(void); bool ListIsFull(void); bool CurIsEmpty(void); protected: pointer_t head; // pointer to head node pointer_t cur; // pointer to current node pointer_t prev; // pointer to previous node pointer_t MakeNode(el_t); void DestroyNode(pointer_t); void NodeReferenceError(void); }; typedef struct node_t* pointer_t; (Dynamic allocation) struct node_t { el_t el; pointer_t next; }; // class definition for queue ADT class queue { public: queue (void ); // default constructor ~queue (void ); // default destructor bool QueueIsEmpty (void ); // is queue empty? bool QueueIsFull (void ); // is queue full? void EnQueue (el_t ); // enqueue item void DeQueue (el_t&); // dequeue item void RetrieveQueue(el_t&); // retrieve front item private: pointer_t front; pointer_t rear; void QueueError(char*); // print error message & abort pointer_t MakeNode(el_t); // create node void DestroyNode(pointer_t);; // destroy nod }; // class definition for stack ADT class stack { public: stack (void ); // default constructor ~stack (void ); // default destructor bool StackIsEmpty (void ); // is stack empty? bool StackIsFull (void ); // is stack full? void Push (el_t ); // push item void Pop (el_t&); // pop top item private: pointer_t top; void StackError(char*); // error handler pointer_t MakeNode(el_t); // create node void DestroyNode(pointer_t); // destroy node }; // class definition for binary tree ADT class bintree { public: bintree(void); // default constructor ~bintree(void); // default destructor bool TreeIsEmpty(void); // is tree empty? Bool TreeIsFull(void); // is tree full? bool LeftIsEmpty(void); // is left subtree empty? Bool RightIsEmpty(void); // is right subtree empty? void InsertRoot(el_t); // insert root in empty tree void InsertLeft(el_t); // insert left child void InsertRight(el_t); // insert right child void DeleteRoot(void); // delete root (0 or 1 child) void StoreRootInfo(el_t); // update node information el_t RetrieveRootInfo(void); // get node information bintree *RetrieveLeft(void); // get pointer to left subtree bintree *RetrieveRight(void); // get pointer to right subtree private: void MakeTree(bintree*&, el_t); // create tree void DestroySubtrees(void); // destroy subtrees void TreeError(char*); // print error message and abort el_t el; bintree *parent; bintree *left; bintree *right; bool IsEmpty; }; typedef int key_t; struct el_t { key_t key; … }; // class definition for binary search tree ADT class bstree { public: bstree(int (*)(key_t, key_t)); ~bstree(void); bool BSTIsEmpty(void); bool BSTIsFull(void); void InsertBST(el_t); bool KeyFoundBST(key_t); el_t RetrieveBST(key_t); void DeleteBST(key_t); void InorderTraverseBST(void (*)(el_t&)); private: void InsertBST(el_t, bintree *); bool KeyFoundBST(key_t, bintree *); el_t RetrieveBST(key_t, bintree *); void DeleteBST(key_t, bintree *); void InorderTraverseBintree(bintree *, void (*)(el_t&)); bintree *InorderPredPtr(bintree *); void BSTError(char *); int (*compare)(key_t, key_t); bintree *root; }; // class definition for Hash table ADT const int TABLE_SIZE = 499; enum status_t {EMPTY, CHAIN, OCCUPIED}; struct node_t { el_t el; status_t status; }; class table { public: table(int (*)(key_t, key_t), int (*)(key_t)); // constructor ~table(void); // destructor bool TableIsEmpty(void); // is empty? bool TableIsFull(void); // is full? bool KeyFoundTable(key_t); // key in table? void InsertTable(el_t); // insert or update void DeleteTable(key_t); // delete entry el_t RetrieveTable(key_t); // retrieve entry void TraverseTable(void (*)(el_t&)); // traverse in order protected: static const int TableSize; static const int null; node_t nodes[TABLE_SIZE]; // containers int NodeCount; // number or entries int (*compare)(key_t, key_t); // comparison function int (*hash)(key_t); // function int FindSlot(key_t); // find available slot for insertion int FindKey(key_t); // find slot containing key void TableError(char *); }; // class definition for graph ADT // (Adjacency Matrix Implementation) #define NUMNODES 16 #define NULL_INDEX –1 typedef unsigned int count_t; typedef unsigned int index_t; typedef int key_t; struct el_t { key_t key; … }; class graph { public: graph(bool (*)(key_t, key_t)); // constructor ~graph(void); // destructor bool GraphIsFull(void); // is full? bool GraphIsEmpty(void); // is empty? bool KeyFoundGraph(key_t); // is key in graph? bool IsAdjacent(key_t, key_t); // are nodes adjacent? void InsertNode(el_t); // insert node void InsertEdge(key_t, key_t); // insert edge void DeleteNode(key_t); // delete node void DeleteEdge(key_t, key_t); // delete edge void UpdateNode(el_t); // update information el_t RetrieveNode(key_t); // retrieve information void TraverseGraph(void (*)(el_t&)); // travel through graph private: count_t count; // number of nodes el_t nodes[NUMNODES]; // container for nodes bool edges[NUMNODES][NUMNODES]; // stores edges bool (*MatchFound)(key_t, key_t); // are keys equal? index_t FindNode(key_t); // returns index of key void GraphError(char*); // error handler }; enum Error_code { success, fail, range_error, underflow, overflow, fatal, not_present, duplicate_error, entry_inserted, entry_found, internal_error}; Binary tree template <class Entry> struct Binary_node { // data members: Entry data; Binary_node<Entry> *left; Binary_node<Entry> *right; // constructors: Binary_node( ); Binary_node(const Entry &x); }; template <class Entry> class Binary_tree { public: Binary_tree( ); bool empty( ) const; void preorder(void (*visit)(Entry &)); void inorder(void (*visit)(Entry &)); void postorder(void (*visit)(Entry &)); int size( ) const; void clear( ); int height( ) const; void insert(const Entry &); Binary_tree (const Binary_tree<Entry> &original); Binary_tree & operator = (const Binary_tree<Entry> &original); Binary_tree( ); protected: // Add auxiliary function prototypes here. Binary_node<Entry> *root; }; Binary Search_tree template <class Record> class Search_tree: public Binary_tree<Record> { public: / *If a Record with a key matching that of new_data already belongs to the Search_tree a code of duplicate_error is returned. Otherwise, the Record new_data is inserted into the tree in such a way that the properties of a binary search_tree are preserved, and a code of success is returned. */ Error_code insert(const Record &new_data); /* Post: If a Record with a key matching that of target belongs to the Search_tree a code of success is returned and the corresponding node is removed from the tree. Otherwise, a code of not_present is returned. */ Error_code remove(const Record &old_data); /* Post: If there is an entry in the tree whose key matches that in target , the parameter target is replaced by the corresponding record from the tree and a code of success is returned. Otherwise a code of not_present is returned. */ Error_code tree_search(Record &target) const; private: // Add auxiliary function prototypes here. }; AVL Tree // the structure is modified to include dummy // versions of get_balance() and set_balance() enum Balance_factor {left_higher, equal_height, right_higher } template <class Entry> struct Binary_node { // data members: Entry data; Binary_node<Entry> *left; Binary_node<Entry> *right; // constructors: Binary_node( ); Binary_node(const Entry &x); // virtual methods: virtual void set_balance(Balance_factor b); virtual Balance_factor get_balance( ) const; }; template <class Record> struct AVL_node: public Binary_node<Record> { // additional data member: Balance_factor balance; // constructors: AVL_node( ); AVL_node(const Record &x); // overridden virtual functions: void set_balance(Balance_factor b); Balance_factor get_balance( ) const; }; template <class Record> class AVL tree: public Search_tree<Record> { public: Error_code insert(const Record &new_data); Error_code remove(const Record &old_data); private: // Add auxiliary function prototypes here. }; B_ Tree template <class Record, int order> struct B_node { // data members: int count; Record data[order - 1]; B_node<Record, order> *branch[order]; // constructor: B_node( |