المشاركة الأصلية كتبت بواسطة saousana
Rfet Jordan University of Science and Technology
Department of Computer Science
CS 211 – Data Structures I
Project 2 ( Linked Stack )
1) Duplicate: ( method): which use pointers only without any function members or temporary Stack) that duplicates specific Stack item .
Example: duplicate 3
Before : S 1, 2, 3,4
After : S 1, 2, 3,3, 4
************************************************** **********************
2) DuplicateNodes: ( method: which use pointers only without any function members or temporary Stack) that takes int value as a parameter and duplicates nodes as the following pattern.
Example:
Before: S : 1, 2, 3, 4
After calling DuplicateNodes(7) :
S: 7, 1, 7, 2, 7, 3, 7, 4, 7
************************************************** **********************
3) InsertSorted (independent function) , that insert an item in it’s right ******** in a sorted stack , that is if 6 is to be inserted to the stack :
Top: 1,3,5,9,10,12 the stack will be 1,3,5,6,9,10,12
************************************************** **********************
4) Check-Palindrom(friend ) : Palindrom is the data spelled identically forwards and backwards such as RADAR. This function should check if the stack is palindrom return true else return false , the function should keep the same items and order of the stack .
Exmaple :
This Stack is a palindrom 123 4 321
also this Stack is a palindrom 1 2 3 3 2 1
this Stack is not palindrom 1 2 3 5 6 1
************************************************** **********************
5) Clear_redundent(independent): clears all redundent values in the stack keeping only the first value found.(the stack would shrink after this operation).Example : if the *******s of the stack like this
12 3 5 5 6 7 6 8 7 12 12 1 2 5
then the Clear_redundent should leave the stack with *******s like this
12 3 5 6 7 8 1 2
************************************************** **********************
6) RemoveItem (independent): This function should remove all occurrences of item from the stack , and should keep the same order of the other items
example :
S (before removing) 1 2 4 5 2 5 2 6 2
RemoveItem( 2 )
S (after removing ) 1 4 5 5 6
************************************************** **********************
7) Intersection(independent): takes 2 stacks as parameters then find the same items that found at Stack1 and Stack2 .
************************************************** **********************
8) Union(independent): takes 2 Stacks as parameters then find the union elements at Stack1 and Stack2.
************************************************** **********************
9) Difference(independent) : function that take two stacks A and B , and return a stack of the Difference A- B , that is all items in A that don’t exist in B .
************************************************** **********************
10) InsertAt ( Independent function) : that inserts a specific value into a specific position in the Stack.
************************************************** **********************
وتمتع بالطعم
مواقع النشر (المفضلة)