: ..



: [1] 2 3 4

happyface_
14-07-09, 07:50 PM




.. ..


^_^

e7sas_ontha
14-07-09, 09:19 PM


:d


:(
:(

:(
:)

:)
:)

happyface_
14-07-09, 09:39 PM
.. .. ^_^

Dr.House
14-07-09, 10:06 PM
97






e7sas_ontha
14-07-09, 10:07 PM
888888

:5:


:(
:(


:(


:o:

:)

happyface_
14-07-09, 10:19 PM
97











.. ^_^

Dr.House
14-07-09, 10:34 PM
^^^
ADT

happyface_
14-07-09, 10:53 PM
^^^
ADT


ADT .. ^_^

abo.abdollaah
15-07-09, 12:36 AM
====================



... ... :- abo.abdollaah


===================

happyface_
15-07-09, 04:10 PM
Dr.House abo.abdollaah ...... :)

/ ADT / ..

16-07-09, 04:56 AM
Dr.House abo.abdollaah ...... :)

/ ADT / ..


Dr.House
16-07-09, 03:16 PM
ADT




Array Linked list



Array :

:

:
: { }
Index .

:


:
100 ( ) 6



size


********************

:


Node .

.








ADT



17-07-09, 11:29 PM
..
Dr.house

..
linked list
..


18-07-09, 12:04 AM
,,,




,,,

happyface_
18-07-09, 09:28 AM
Dr.house :)

/ Algorithm Efficiency

..


i=1
loop (i<=10)
j=1
loop (j<=10)
application code
j= j x 2
end loop
i=i + 1
end loop


f(n)= n [log2 n]

Dr.House
18-07-09, 10:44 AM


Singly Linked List

(http://computerar.net/f328/)


happyface_
18-07-09, 09:23 PM


Singly Linked List

(http://computerar.net/f328/)




:)




.. Algorithm Efficiency

..


i=1
loop (i<=10)
j=1
loop (j<=10)
application code
j= j x 2
end loop
i=i + 1
end loop


f(n)= n [log2 n]

Dr.House
18-07-09, 10:29 PM
Algorithm Efficiency





: (())






Algorithm Efficiency










:



f(n)=efficiency




















i=1
loop (i<=1000)

application code

i=i+1



:





iteration Value of i
1 1
2 2
3 3

1000 1000




n

:
f(n)=n












i=i+1


n 1000











......

i=i+2














:




i=1
loop (i<1000)
application code
i=i x 2
end loop






1 1
2 2
4 3
8 4
15 5
32 6
64 7
128 8
256 9
512 10
1024 Exit










2 iteration

!!
:



f(n)= log2 n







...




i=1000
loop (i>=1)
application code
i=i / 2
end loop




iteration Value of i
1 1000
2 500
3 250
4 125
5 62
6 31
7 15
8 7
9 3
10 1
Exit 0






*******************************







:










i=1
loop (i<=10)
j=1
loop (j<=i)
application code
j= j + 1
end loop
i=i + 1
end loop







f(n)=n [(n+1)/2]


















....




+








:


i=1loop (i<=10) loop (j<=10) application code j= j +1
end loop i=i + 1end loop


:



2
f(n)= n








happyface_
19-07-09, 11:40 AM
Dr.House :)

20-07-09, 04:20 AM
..

...

.. 4 ..


:)

willpower
20-07-09, 10:59 PM
bookmarks :D






..

(F)

sar0o0na
21-07-09, 01:36 AM





21-07-09, 07:33 PM

~{First One}~
22-07-09, 04:08 AM


Singly Linked List

(http://computerar.net/f328/)



...:1002:

compaq
22-07-09, 01:28 PM
..





........

happyface_
22-07-09, 03:37 PM



&

http://www.4shared.com/file/119813839/5c84ff2/chapter1.html



>> :D

Dr.House
25-07-09, 07:23 AM
happyface_

:)



Double Circular










:

http://computerar.net/f339/



willpower
27-07-09, 10:48 PM


:D





http://academics.tjhsst.edu/compsci/CS2C/U6/polys.html




:D

:$

willpower
27-07-09, 11:31 PM
33 150

:D

28-07-09, 04:18 AM
..

... ..


...



http://www.7ammil.com/dld4t243205.rar.html


..



: .. .. ..













..





........



.. .. ..





happyface_
30-07-09, 01:23 PM
Dr.House & (:

happyface_
12-08-09, 06:27 PM



queues, stack tree and binary search tree ..

Dr.House
14-08-09, 04:02 AM




http://computerar.net/f341/



:)

e7sas_ontha
14-08-09, 02:11 PM
Dr.House





:)

. .
= :d




= :d



:(

:)


:)

e7sas_ontha
14-08-09, 02:31 PM


:(



:(






:)

happyface_
14-08-09, 04:18 PM
:)

happyface_
14-08-09, 04:58 PM


:(



:(






:)



Dr.House
14-08-09, 07:44 PM



Trees


Array Linked List
..
..




root

3 ..


( ) leaves nodes
degree of node 1 2 ...
leaves nodes degree = ..

path



level of node ( )

height of tree : ..


()


..
..



Binary search tree


..

4
\ /
6 2
\ / \
7 5 3


4 (6,7,5)
(2,3)
BST

8
8

8 6 root->right

8 7

null




4
\ /
6 2
\ / \
7 5 3
\
8


^^^
8 7 :D



1



1 2

2 null

3 1




:
** BST
BST ..

** ..











:rolleyes:

14-08-09, 07:44 PM
..

..Կ

..

Dr.House
14-08-09, 07:48 PM


:(



:(






:)


e7sas_ontha
14-08-09, 07:57 PM
.
:)












:d

:)

***




:(
:)



e7sas_ontha
14-08-09, 08:07 PM


:)



:d








algorithm breadthFirst (val root <node pointer>)
Process tree using breadth-first traversal.
Pre root is a pointer to a tree node
Post tree has been processed

pointer = root
loop (pointer not null)
process (pointer)
if (pointer->left not null)
enqueue (pointer->left)
end if
if (pointer->right not null)
enqueue (pointer->left)
end if
if (not emptyQueue)
dequeue (pointer)
else
pointer = null
end if
end loop
return
end postOrder






**************
























********










********



:)



:smile13::ph34r:

14-08-09, 08:14 PM
.
:)




:d

:)

***




:(
:)




:1003: .. ɿ

:)

e7sas_ontha
14-08-09, 08:19 PM
.. ɿ




= :d

e7sas_ontha
14-08-09, 08:29 PM



http://www.F5ry.com/view.php?file=4bb4e3ecfa

= :d

happyface_
14-08-09, 08:30 PM

http://www.4shared.com/file/125045539/45e7e3f7/stack_and_Queue__sorting__BST_Tree.html

happyface_
14-08-09, 08:31 PM



http://www.F5ry.com/view.php?file=4bb4e3ecfa

= :d

:D

happyface_
14-08-09, 08:39 PM




http://www.4shared.com/file/125046954/76a36e46/data_structure__queuestacktree.html

14-08-09, 08:39 PM
..
:)

DR.house
E7sas ontha
Happyface

..

e7sas_ontha
14-08-09, 08:51 PM
8888


:)

Dr.House
14-08-09, 10:13 PM
e7sas_ontha








e7sas_ontha
3


preOrder
inOrder
postOrder


:rolleyes:


( :D) :

pointer = root
while (pointer !=null)
process (pointer)
if (pointer->left !=null)
enqueue (pointer->left)
if (pointer->right !=null)
enqueue (pointer->right)
if (not emptyQueue)
dequeue (pointer)
else
pointer null
return





- pop ( null ) ..
- null
-
- while loop pointer null





struct





struct TreeNode
{
int value;
TreeNode *left;
TreeNode *right;
TreeNode(int data) {value = data; left= NULL; right=NULL;}
~TreeNode() {};
};




->















BST
worst case = o(n)


.. :rolleyes:

e7sas_ontha
14-08-09, 10:30 PM



= :d


= :d


( ) :

:d
:d



..


!






= :d


:d



:)

e7sas_ontha
14-08-09, 10:37 PM
e7sas_ontha
3


preOrder
inOrder
postOrder





= :d

= :d

:o









Dr.House
14-08-09, 10:48 PM


:D






..









:rolleyes:
C++ :D







..

( )
..













( :rolleyes:)



:)



Dr.House

e7sas_ontha
14-08-09, 11:07 PM


:d
:d



..




:d

4


4 :d




C++




= :d
:)




..

( )
..



abcdeg
gedcba

!!!! = :o





:) = :d

Dr.House
14-08-09, 11:24 PM


abcdeg
gedcba

( ) ..

e7sas_ontha
14-08-09, 11:30 PM

( ) ..




:o
:o

:o



= :d

abo.abdollaah
15-08-09, 12:47 AM
:110::110::110:

...

http://www.4shared.com/get/124660216/df11c19a/_aboabdollaah.html

...

e7sas_ontha
15-08-09, 12:56 AM





:)

abo.abdollaah
15-08-09, 01:09 AM
888888



...


=================================

15-08-09, 01:50 AM
...

..

abo.abdollaah
15-08-09, 10:52 PM
...

http://www.imam1.com/vb/showthread.php?p=1546790#post1546790 (http://www.imam1.com/vb/showthread.php?p=1546790#post1546790)

16-08-09, 04:37 AM
...

stack

...

stack queue



algorithm popStack (ref stack <metadata>, ref dataout <data type>)
This algorithm pops the item on the top of the stack and returns it to the user
Pre stack is metadata structure to a valid stack
dataout is a reference variable to receive the data
Post data have been returned to calling algorithm
Return true if successful, false if underflow

If (emptystack())
successes = false
else
dltptr = stack.top
dataout = stack.top->data
stack.top = stack.top->next
stack.count = stack.count 1
Recycle (dltptr)
successes = true
end if
return successes
end popStack

t3b
16-08-09, 12:43 PM




:


algorithm popStack

..


..

If (emptystack())
successes = false


..

emptystack ,

.. ..

..

else


..


..

dltptr = stack.top

..

dltptr stack.top

..


dataout = stack.top->data

.. ..

..



,


..


stack.top = stack.top->next
..
( )




.. .. ..


..


stack.count = stack.count 1
..


..


Recycle (dltptr)
.. ..

.






:


:$

..

Computer Science girl
16-08-09, 01:15 PM
God With You,Thanks:rolleyes:

Dr.House
16-08-09, 01:39 PM
...

http://www.imam1.com/vb/showthread.php?p=1546790#post1546790 (http://www.imam1.com/vb/showthread.php?p=1546790#post1546790)



:)

t3b
16-08-09, 03:09 PM
:(



..


Q3:
Suppose you have to maintain a list of items for a particular application. For
each of the following situations explain whether the array based lists or linked lists are better suited
1. The maximal size of the list can not exceed a known bound. You expect that you will have to perform many insertions and deletions of elements in the list. The application is time sensitive.
2. The maximal size of the list can not exceed a known bound. You expect that you will have to perform many retrievals of elements in the list using their position as a key. The application is time sensitive.
3. The access to any element in the list must be of order O(1).
4. The data stored in each node requires a big swat of memory to be stored.

Q4:
In the circular array version of the queue class (with fixed-sized array), which operations require linear time for their worst-case behavior?
1. enqueue
2. dequeue
3. clear_queue
4. None of the above




Q5:
In the pointer based implementation of the queue class (with front and tail pointers), which operations require linear time for their worst-case behavior?
1. enqueue
2. dequeue
3. clear_queue
4. None of the above

16-08-09, 08:26 PM
T3b

..
...

16-08-09, 10:49 PM
...

tree

preorder inorder :
tree postorder

ǿ

Dr.House
16-08-09, 11:50 PM
T3b
..

..





..

17-08-09, 12:22 AM
7
7
7

Dr.house

...

happyface_
17-08-09, 01:08 PM

Dr.House
abo.abdollaah

:D

e7sas_ontha
17-08-09, 01:25 PM
Dr.House
abo.abdollaah



:)
:)

Dr.House
17-08-09, 06:09 PM




..




http://up.arab-x.com/Aug09/EgC21446.jpg



:
inOrder: B F G H P R S T W Y Z
postOrder: B G H F R W T Z Y S P

..
root
root post pre

inOrder ..


:

: post ( ) in
in



:
in


in : B F G H
post : B G H F
() F
in F P
F B G H
F B
:
in : G H
post : G H

post H F

G



.. P root F F .. B H .. H G


..
:
in : R S T W Y Z
post : R W T Z Y S

root post in
S P
S
: () ..

:
in : T W Y Z
post : W T Z Y

S post Y
in y Z
Y Z

:
in : T W
post : W T

Y post T
T W

:
root S
S Y R
Y ( Z T )
T W


preOrder :
P F B H G S R Y T W Z


:)


Dr.House






.

abo.abdollaah
17-08-09, 06:19 PM
Dr.House
...

17-08-09, 06:50 PM
Dr.House
Abo.Abdollah

...


:)

happyface_
18-08-09, 06:35 AM
AVL tree :D

e7sas_ontha
19-08-09, 01:42 AM
888

:o
AVL = :d

:
AVL

BF 0 -1 1

:d = :d :d

:d =
= :d


:)

= :d

happyface_
19-08-09, 03:01 PM
888

:o
AVL = :d

:
AVL

BF 0 -1 1

:d = :d :d

:d =
= :d


:)

= :d




:D .. ... :smile15: ..

Dr.House
19-08-09, 04:01 PM
happyface_

:cool:
BST

:)


.

happyface_
19-08-09, 05:09 PM
happyface_

:cool:
BST

:)


.

.. 1 , 0 , -1 .. :smile13:

:)

t3b
23-08-09, 03:52 AM
:(

, :nonono:


,

~ ~
23-08-09, 08:03 AM



,




t3b
23-08-09, 02:10 PM


:(


,

e7sas_ontha
23-08-09, 03:04 PM




t3b
= :d






AVL


:d

happyface_
23-08-09, 04:16 PM


AVL


:d


.. :humm: ..



+ :nonono: .. ..

Dr.House
23-08-09, 08:28 PM



AVL


- AVL BST Balanced () ..

- BST Rotation

- Balance factor BF - ..

- BF 1 -1 ..





Rotation
..

Single Left Rotation SLR pivot .

Single Right Rotation SRR pivot .

3- Double Left Rotation DLR SLR pivot SRR ..

Double Right Rotation DRR SRR pivot SLR ..




..
- node BF = +2
SLR Root Pivot

- node BF = +2
DRR SRR + SLR .. SLR pivot SRR ..

- node BF = -2
SRR

- node BF = -2
DLR SRR SLR ..


..
SLR = ..
SRR = ..
DLR = SRR SLR
DRR = SLR SRR






..

e7sas_ontha
23-08-09, 11:47 PM









:o




:(
:o
= :d


***
AVL = :d







:)

:d

happyface_
24-08-09, 12:10 AM
:o



:D



AVL = :d


:D




:)

e7sas_ontha
24-08-09, 12:18 AM
4

!:d
:o




:o





= :d

happyface_
24-08-09, 12:23 AM
4

!:d
:o




:o

:d

..







=

:D

sar0o0na
24-08-09, 12:37 AM


㿿

( 7:30 ) 9



...

e7sas_ontha
24-08-09, 12:40 AM


10
10

:d

sar0o0na
24-08-09, 12:43 AM








9



...............

happyface_
24-08-09, 12:46 AM








9



...............

10

sar0o0na
24-08-09, 12:49 AM





24-08-09, 12:56 AM
Dr.house

..
...

:)

abo.abdollaah
24-08-09, 12:59 AM
&& &&

* ...

* ...

* ...

e7sas_ontha
24-08-09, 01:07 AM

:d

10 10



10
:d





:)



AVL

= :o

24-08-09, 01:20 AM
7
7
7

!

:)

24-08-09, 01:25 AM
..

:(

:)



void stackQueue() {
Queue q1;
Stack s1;
int num,x;
num = 0;
While (num>=0) {
cin>>num;
if (num !=0)
s1.push(num);
else {
s1.pop(x);
s1.pop(x);
while (s1.top !=NULL)
{
s1.pop(x);
q1.enqueue(x);
}//end while
}//end else
} // end of while
}



:

The data are 5,7,12,4,0,4,6,8,67,34,23,5,0,44,33,22,11,0,2,1,-1


..

Dr.House
24-08-09, 05:03 PM
..
.. while



int


Queue q1;
Stack s1;
int num,x;
num = 0;

while

While (num>=0) {
cin>>num;


s1

if (num !=0)
s1.push(num);

else
else
pop ( ) ..


else {
s1.pop(x);
s1.pop(x);

..
..
..
q1


..


..

while (s1.top !=NULL)

s1 q1


{
s1.pop(x);
q1.enqueue(x);
}//end while




}//end while
}//end else
} // end of while
}


..


5,7,12,4,0,4,6,8,67,34,23,5,0,44,33,22,11,0,2,1,-1


5 7 12 4

12 4
while while s1

5 7
q1



4 6 8 67 34 23 5

5 23
q1 4 6 8 67 34



44 33 22 11

11 22
q1





s1 q1 :


http://up.arab-x.com/Aug09/KXt07722.jpg

..

top





..



.

e7sas_ontha
24-08-09, 07:46 PM

= :d






:d

Dr.House
24-08-09, 10:02 PM
:)


..

..

1 - 7 AVL




3,2,1,4,5,6,7

BST


:

http://up.arab-x.com/Aug09/Xxo39339.jpg

:
BF ..
..


node
2 3
1 ..
SRR pivot 3






:

http://up.arab-x.com/Aug09/0Zu39339.jpg

1 5 SLR pivot 3
4 3



6 ( SLR)

http://up.arab-x.com/Aug09/M6T39339.jpg


7 (SLR)

http://up.arab-x.com/Aug09/Ig240120.jpg


Double

:)



KSU student...IT
24-08-09, 10:48 PM
俿



39 :D>> 40 >> :rolleyes:

:D

:D

:D

>> :smile13:
:D

:1002:


:1002:

24-08-09, 10:56 PM
Dr.House

!

!!

24-08-09, 10:59 PM
.








26-08-09, 05:44 PM


. . 1 2

efficency




29-08-09, 01:27 AM
..
.. while



int


Queue q1;
Stack s1;
int num,x;
num = 0;

while

While (num>=0) {
cin>>num;


s1

if (num !=0)
s1.push(num);

else
else
pop ( ) ..


else {
s1.pop(x);
s1.pop(x);

..
..
..
q1


..


..

while (s1.top !=NULL)

s1 q1


{
s1.pop(x);
q1.enqueue(x);
}//end while




}//end while
}//end else
} // end of while
}


..


5,7,12,4,0,4,6,8,67,34,23,5,0,44,33,22,11,0,2,1,-1


5 7 12 4

12 4
while while s1

5 7
q1



4 6 8 67 34 23 5

5 23
q1 4 6 8 67 34



44 33 22 11

11 22
q1





s1 q1 :


http://up.arab-x.com/Aug09/KXt07722.jpg

..

top





..



.




dr.house

...



s1.pop(x);
q1.enqueue(x

7 5 enqueue

enqueue :
q1.enqueue(s1)

s1 ?

Dr.House
29-08-09, 09:42 PM
:)






7 5 enqueue
while while top = null
..





enqueue :
q1.enqueue(s1)




q1.enqueue(s1.pop())





:)




.

29-08-09, 10:33 PM
dr.house ..

:)

t3b
31-08-09, 05:53 PM
:D


, ,

,


, , : )

31-08-09, 10:19 PM
:)

...

31-08-09, 10:44 PM
.......

ToT
24-10-09, 10:02 PM


:d


:(
:(

:(
:)

:)
:)

/ ,,

:1111:

25-10-09, 12:10 AM
/ ,,

:1111:


ToT
25-10-09, 08:10 PM

,,

http://www.4shared.com/file/120382392/a0dc26f6/Data_structure.html

ToT
26-10-09, 05:29 AM





, , 245

26-10-09, 09:48 PM
8 8 88 88

...

Child Dreams
11-12-09, 02:09 PM
Up

" .. :) "

Child Dreams
11-12-09, 03:45 PM
" " ..

.. " .. .. " ... --> .. ..

.. :o

11-12-09, 04:35 PM
:11icon: :11icon:




+ +

:1003:

Child Dreams
11-12-09, 05:06 PM
:o

11-12-09, 06:00 PM
^^^^


Child Dreams
11-12-09, 06:03 PM
.. ADTs ..

11-12-09, 06:08 PM
^^^

ADT

ADT struct

runtime Error

Child Dreams
11-12-09, 06:12 PM
..

: (

ADTs ..

Child Dreams
12-12-09, 04:47 PM
.. :)

Haifa Mohammed
12-12-09, 04:56 PM


:D

12-12-09, 08:52 PM
888888

..:Money-Eyes:


..

3 .. size .. 700 (larg size ) .. 699 200 ( medium size ) .. 200 ( small size )....

... ...

( queuue .. ) .. .. .. ...

( :D) size ...

.........


: ADT ...queue ,stack
:
: SIZE
: ... ...

...

Child Dreams
12-12-09, 09:15 PM
~

12-12-09, 09:24 PM
!!!

...


Haifa Mohammed
12-12-09, 09:26 PM
888888



( queuue .. ) .. .. .. ...

( :D) size ...





:D

:::


12-12-09, 09:41 PM


:D

:::



... ( )..

( the end ) stack

12-12-09, 09:53 PM
: SIZE

忿

..



Child Dreams
12-12-09, 10:04 PM
忿

..






" "

array of stack ..
..~
..

:humm:

12-12-09, 10:12 PM


" "

array of stack ..
..~
..

:humm:

ʿ
..
:smile15:

..


..

Child Dreams
12-12-09, 10:14 PM
^
. !
.. .. .. !!

.. :|

12-12-09, 10:19 PM
:1003:

Child Dreams
12-12-09, 10:21 PM
^
.. ..

:o

12-12-09, 10:23 PM
888



STACK ,QUEUE


[]
12-12-09, 10:26 PM
()

( ) =

( ) =

( ) =


^

[]
12-12-09, 10:28 PM






( 3)



^

Child Dreams
12-12-09, 10:29 PM
^
:| :|

[]
12-12-09, 10:29 PM


߿ ǿ

( )



P:

12-12-09, 10:30 PM




3




Child Dreams
12-12-09, 10:32 PM
" 3 .. "
..

.. .. :S

12-12-09, 10:33 PM









Child Dreams
12-12-09, 10:34 PM
.. .. .. ..

.. :S :D

12-12-09, 10:36 PM
888

..<<

[]
12-12-09, 10:37 PM


3 // () = 3





-




1




2


Child Dreams
12-12-09, 10:38 PM
.. ..

.. " :S " .. " " " "

.. ..


1

[]
12-12-09, 10:40 PM
^


: )


-







12-12-09, 10:40 PM
...

12-12-09, 10:41 PM


濿

߿

Child Dreams
12-12-09, 10:42 PM
.. :|

[]
12-12-09, 10:42 PM




-


,


,

12-12-09, 10:45 PM








[]
12-12-09, 10:46 PM
/

1-

2-






1-

2-

Child Dreams
12-12-09, 10:46 PM
.. .. .. .. ..

.. .. range .. .. .. " .. :(

[]
12-12-09, 11:01 PM



:





Child Dreams
12-12-09, 11:02 PM
^


[]
12-12-09, 11:02 PM





[]
12-12-09, 11:03 PM


=

Child Dreams
12-12-09, 11:05 PM
.
.. ..

:S :|

12-12-09, 11:07 PM






<<


Haifa Mohammed
12-12-09, 11:08 PM
C++ :D

12-12-09, 11:09 PM
888


12-12-09, 11:10 PM



Haifa Mohammed
12-12-09, 11:12 PM
:d

adt

:(

[]
12-12-09, 11:13 PM
,




[]
12-12-09, 11:15 PM
,



[]
12-12-09, 11:19 PM


3
1=
2=
3=


4


ѿ




---------


1







---------

2








---------------

3
=


[]
12-12-09, 11:23 PM


>_>

12-12-09, 11:26 PM
888


[]
12-12-09, 11:36 PM
^
P:







^^
+ : )



()

12-12-09, 11:36 PM
2









... ...
...


: .. !!!

..

... ..

!!! 5 ʿ

[]
12-12-09, 11:41 PM


:

<,> [3]

[0].(__1)
[1].(__1)
[2].(__1)
[0].(__2)


^
Ϳ

12-12-09, 11:45 PM
..

,
... !!

....:D

[]
12-12-09, 11:51 PM

{
<> ߺ

}


<,>

1

1,2,3,4,5

1..(1)
1..(2)
.
.
.


.(1)

[]
12-12-09, 11:52 PM
^


!!! 5 ʿ

[]
12-12-09, 11:53 PM






[]
12-12-09, 11:58 PM





# include <iostream>
using namespace std ;
# include "List.h"
# include "Stack.h"


struct student {
Stack<string> s ;
string n ;
int key ; } ;

int main () {
student n1 ;
n1.n = "A" ;
n1.key = 1 ;
string s=" cs242";
n1.s.pushStack (s);
n1.s.pushStack (s);
n1.s.pushStack (s);
n1.s.pushStack (s);
n1.s.pushStack (s);
student n2 ;
n2.n = "B" ;
n2.key = 2 ;
n2.s.pushStack (s);
n2.s.pushStack (s);
n2.s.pushStack (s);
n2.s.pushStack (s);
n2.s.pushStack (s);
student n3 ;
n3.n ="C" ;
n3.key = 3 ;
n3.s.pushStack (s);
n3.s.pushStack (s);
n3.s.pushStack (s);
n3.s.pushStack (s);
n3.s.pushStack (s);

List <student,int> lst ;
cout<<lst.addNode(n1)<<endl ;
cout<<lst.addNode(n2)<<endl;
cout<<lst.addNode(n3)<<endl;

return 0 ; }


^











.

13-12-09, 12:12 AM



..


..

..^_^..

[]
13-12-09, 03:56 PM
^^

S3OOD
13-12-09, 04:07 PM






..

..






:P

13-12-09, 04:29 PM
;1941052'] ^^

,,

,,


!!
( :smile21: )
..
:

..
..

level 8

>>
..



box level ( )
..

..

..
2

print
...


..
:876:
..

Haifa Mohammed
13-12-09, 04:45 PM
^
^





::
:D




queue

:D

::

c++

13-12-09, 05:03 PM
8
8


id level

..
:)

Dr.House
13-12-09, 05:25 PM






:P

:D
.. :cool:..
.. 1 2

[]
13-12-09, 05:46 PM
!






: )

Haifa Mohammed
13-12-09, 06:04 PM
student

:D




struct student {
Stack<string> s ;
string n ;
int key ; } ;


student

:(

Child Dreams
13-12-09, 06:07 PM
..


: " "

.. ..
8 .. ..
8 .. ..

main .. :)



/************************************************** **************
* Your Name : *
* Your ID : *
* Your Section: *
* Your PC No. : *
* *
************************************************** **************/


// ----------------- Write the Needed Includes -----------------//

#include <string>
#include <iostream>

using namespace std;

//--------------------------------------------------------------//



// ---------- Book Information ---------- //

struct BookInfo
{
string Title, AuthourName;
int Level, key; // Id of the book

};

//----------------------------------------//




// -------- Functions Prototypes -------- //

int Menu();

void AddBookToBox(/*write appropriate parameter(s)*/); // Already implemented BUT NOT complete .. Complete it !

void CountBooks(/* write appropriate parameter(s)*/); // Implement it !

bool ReturnBooksTo****ves(/* write appropriate parameter(s)*/ ); // implement it !

void PrintAllBooksOfSpecific****f(/* write appropriate parameter(s)*/); // It is Bonus :) !

//----------------------------------------//







// ------------------------------------------------------------------------------



int main ()
{
// ---------- Declarations ---------
int choice;

/*Declare appropriate data structure(s)*/


// ----------------------------------

do{
choice = Menu();
switch(choice)
{
case 1:
// Call the appropriate function with appropriate parameter(s)
break;

case 2:

// Call the appropriate function with appropriate parameter(s)
break;

case 3:

// Call the appropriate function with appropriate parameter(s)
break;

case 4:

// Call the appropriate function with appropriate parameter(s)
break;

case 5:
cout<<"Good Luck\n";
break;

default :
cout<<"Invalid Choice !\n";

}// end switch
}while ( choice != 5);

return 0;

}




int Menu()
{
int choice;
cout<<"\n---------------------------------------------------------\n";

cout<<"1- Return a borrowed book and put it in the box ( Add Book to Box) \n"
<<"2- Count each level's books of the overall returned books\n"
<<"3- Return books to thier correct locations\n"
<<"4- Print information of all books in a specific ****f\n"
<<"5- Exit\n";

cout<<"---------------------------------------------------------\n";

cout<<"Enter Your Choice: ";
cin >>choice;

cout<<endl;

return choice;
}

// ------------------------------------------------------------------------------

void AddBookToBox(/*write appropriate parameter(s)*/ )
{

BookInfo ReturnedBook;

cout<<"What is the title of the book you have returned? ";
cin>>ReturnedBook.Title;

cout<<"\nWhat is its Id? ";
cin>>ReturnedBook.key;

cout<<"\nWho is the authour? ";
cin>>ReturnedBook.AuthourName;

cout<<"\nTo which level it belongs? ";
cin>>ReturnedBook.Level;

cout<<endl;

if ( /* call a function that adds a book to the box*/ )
cout<<"Thanks.. You have added the book Successfully\n";
else
cout<<"Sorry.. The box if full Now come back later!\n";

}

// ------------------------------------------------------------------------------

void CountBooks(/* write appropriate parameter(s)*/)
{


// Write your code here !




}


// ------------------------------------------------------------------------------

bool ReturnBooksTo****ves(/* write appropriate parameter(s)*/ )
{

// Write your code here !



}// end function


// ------------------------------------------------------------------------------

void PrintAllBooksOfSpecific****f(/* write appropriate parameter(s)*/)
{


// Write your code here !

}


.. :)

Haifa Mohammed
13-12-09, 06:20 PM
^
^
:d

7 << :d

Haifa Mohammed
13-12-09, 06:41 PM
// ------------------------------------------------------------------------------



void AddBookToBox(Stack<BookInfo> datain )
{

BookInfo ReturnedBook;

cout<<"What is the title of the book you have returned? ";
cin>>ReturnedBook.Title;

cout<<"\nWhat is its Id? ";
cin>>ReturnedBook.key;

cout<<"\nWho is the authour? ";
cin>>ReturnedBook.AuthourName;

cout<<"\nTo which level it belongs? ";
cin>>ReturnedBook.Level;

cout<<endl;

if ( datain.pushStack (ReturnedBook) )
cout<<"Thanks.. You have added the book Successfully\n";
else
cout<<"Sorry.. The box if full Now come back later!\n";

}

// ------------------------------------------------------------------------------


:humm:

13-12-09, 07:08 PM

..
:)

Haifa Mohammed
13-12-09, 07:27 PM
^
^


:D

[]
13-12-09, 07:35 PM


() ()



[]
13-12-09, 08:14 PM

Haifa Mohammed
13-12-09, 08:15 PM
:D

[]
13-12-09, 08:20 PM
,

:D

Haifa Mohammed
13-12-09, 08:30 PM
:D

Child Dreams
13-12-09, 08:36 PM
:D .. < ~

Haifa Mohammed
13-12-09, 08:39 PM


:D

Child Dreams
13-12-09, 08:42 PM
.. :D

:o

[]
13-12-09, 08:50 PM
:humm:



:D









// ----------------- Write the Needed Includes -----------------//

#include <string>
#include <iostream>
#include "List.h"
#include "Stack.h"
using namespace std;

//--------------------------------------------------------------//



// ---------- Book Information ---------- //

struct BookInfo
{
string Title, AuthourName;
int Level, key; // Id of the book

};

//----------------------------------------//




// -------- Functions Prototypes -------- //

int Menu();

void AddBookToBox(Stack<BookInfo> &Tobox);

void CountBooks(Stack<BookInfo> box);

bool ReturnBooksTo****ves(Stack<BookInfo> box,List<BookInfo,int> &****ves[]); !

void PrintAllBooksOfSpecific****f(List<BookInfo,int> ****ves[]);

//----------------------------------------//







// ------------------------------------------------------------------------------



int main ()
{
// ---------- Declarations ---------
int choice;

Stack<BookInfo> box;
List<BookInfo,int> ****ves[8];


// ----------------------------------

do{
choice = Menu();
switch(choice)
{
case 1:
AddBookToBox(box);
break;

case 2:

CountBooks(box);
break;

case 3:

ReturnBooksTo****ves(box,****ves)
break;

case 4:

PrintAllBooksOfSpecific****f(****ves);
break;

case 5:
cout<<"Good Luck\n";
break;

default :
cout<<"Invalid Choice !\n";

}// end switch
}while ( choice != 5);

return 0;

}




int Menu()
{
int choice;
cout<<"\n---------------------------------------------------------\n";

cout<<"1- Return a borrowed book and put it in the box ( Add Book to Box) \n"
<<"2- Count each level's books of the overall returned books\n"
<<"3- Return books to thier correct locations\n"
<<"4- Print information of all books in a specific ****f\n"
<<"5- Exit\n";

cout<<"---------------------------------------------------------\n";

cout<<"Enter Your Choice: ";
cin >>choice;

cout<<endl;

return choice;
}

// ------------------------------------------------------------------------------

void AddBookToBox(Stack<BookInfo> &Tobox)
{

BookInfo ReturnedBook;

cout<<"What is the title of the book you have returned? ";
cin>>ReturnedBook.Title;

cout<<"\nWhat is its Id? ";
cin>>ReturnedBook.key;

cout<<"\nWho is the authour? ";
cin>>ReturnedBook.AuthourName;

cout<<"\nTo which level it belongs? ";
cin>>ReturnedBook.Level;

cout<<endl;

if ( Tobox.pushStack(ReturnedBook) )
cout<<"Thanks.. You have added the book Successfully\n";
else
cout<<"Sorry.. The box if full Now come back later!\n";

}

// ------------------------------------------------------------------------------

void CountBooks(Stack<BookInfo> box)
{
int count1=0,count2=0,count3=0,count4=0,count5=0,count 6=0,count7=0,count8=0;
int lev;
BookInfo bookOut;

while(box.popStack(bookOut))
{
lev=bookOut.Level;
switch(lev)
{
case 1: count1++; break;
case 2: count2++; break;
case 3: count3++; break;
case 4: count4++; break;
case 5: count5++; break;
case 6: count6++; break;
case 7: count7++; break;
case 8: count8++; break;
}
}

cout<<"There are "<<count1<<" books of level 1"<<endl;
cout<<"There are "<<count2<<" books of level 2"<<endl;
cout<<"There are "<<count3<<" books of level 3"<<endl;
cout<<"There are "<<count4<<" books of level 4"<<endl;

cout<<"There are "<<count5<<" books of level 5"<<endl;
cout<<"There are "<<count6<<" books of level 6"<<endl;
cout<<"There are "<<count7<<" books of level 7"<<endl;
cout<<"There are "<<count8<<" books of level 8"<<endl;

}


// ------------------------------------------------------------------------------

bool ReturnBooksTo****ves(Stack<BookInfo> box,List<BookInfo,int> &****ves[] )
{
int lev;
BookInfo bookOut;

while(box.popStack(bookOut))
{
lev=bookOut.Level;
switch(lev)
{
case 1: ****ves[0].addNode(bookOut); break;
case 2: ****ves[1].addNode(bookOut); break;
case 3: ****ves[2].addNode(bookOut); break;
case 4: ****ves[3].addNode(bookOut); break;
case 5: ****ves[4].addNode(bookOut); break;
case 6: ****ves[5].addNode(bookOut); break;
case 7: ****ves[6].addNode(bookOut); break;
case 8: ****ves[7].addNode(bookOut); break;
}


}// end function


// ------------------------------------------------------------------------------

void PrintAllBooksOfSpecific****f(List<BookInfo,int> ****ves[])
{
int lev;
cout<<"enter the level of the ****f thet you need to print it:"; cin>>lev;

BookInfo bookOut;

****ves[lev+1].getNext(0,bookOut);
cout<<bookOut.Title<<endl<<bookOut.AuthourName<<endl<<bookOut.Level<<endl<<bookOut.key<<endl;

while( ****ves[lev+1].getNext(1,bookOut))
{cout<<bookOut.Title<<endl<<bookOut.AuthourName<<endl<<bookOut.Level<<endl<<bookOut.key<<endl;}

}







:

!

Haifa Mohammed
13-12-09, 08:57 PM
^
^
missing

:D

Child Dreams
13-12-09, 09:02 PM
..

.. .. .. .. if .. ..


..

[]
13-12-09, 09:10 PM
:$





..

,
,

ɿ


Child Dreams
13-12-09, 09:13 PM
:$

.. : )

Haifa Mohammed
13-12-09, 09:19 PM
:D

(****)

:D

:D

[]
13-12-09, 09:35 PM
:smile13:








/




Haifa Mohammed
13-12-09, 09:36 PM
// ------------------------------------------------------------------------------

void CountBooks(Stack<BookInfo> box)
{
int count1=0,count2=0,count3=0,count4=0,count5=0,count 6=0,count7=0,count8=0;
int lev;
BookInfo bookOut;

while(box.popStack(bookOut))
{
lev=bookOut.Level;
switch(lev)
{
case 1: count1++; break;
case 2: count2++; break;
case 3: count3++; break;
case 4: count4++; break;
case 5: count5++; break;
case 6: count6++; break;
case 7: count7++; break;
case 8: count8++; break;
}
}

cout<<"There are "<<count1<<" books of level 1"<<endl;
cout<<"There are "<<count2<<" books of level 2"<<endl;
cout<<"There are "<<count3<<" books of level 3"<<endl;
cout<<"There are "<<count4<<" books of level 4"<<endl;

cout<<"There are "<<count5<<" books of level 5"<<endl;
cout<<"There are "<<count6<<" books of level 6"<<endl;
cout<<"There are "<<count7<<" books of level 7"<<endl;
cout<<"There are "<<count8<<" books of level 8"<<endl;

}


// ------------------------------------------------------------------------------





:smile13:

Child Dreams
13-12-09, 09:39 PM
. ..
.. .. ..


Haifa Mohammed
13-12-09, 09:40 PM
;1942175'] :smile13:








/







http://up.arab-x.com/Dec09/zUu29605.jpg

:D

[]
13-12-09, 09:40 PM
- -





/







Ϳ ^^

[]
13-12-09, 09:45 PM


,
,

s h e l v e s




[]
13-12-09, 09:50 PM
. ..
.. .. ..











()

Child Dreams
13-12-09, 09:52 PM
..

..
.. :o

Haifa Mohammed
13-12-09, 09:53 PM
^
^


:D

::



:D

[]
13-12-09, 10:06 PM
^



,


:




..

..
..





..

>>



Child Dreams
13-12-09, 10:08 PM
^
.. :$

..

Haifa Mohammed
13-12-09, 10:11 PM
:D


[]
13-12-09, 10:18 PM
:$



!



()

Child Dreams
13-12-09, 10:28 PM
i hope

..

14-12-09, 05:06 PM



..

<<
:)
...

[]
14-12-09, 07:07 PM


,
!











:










Child Dreams
14-12-09, 10:09 PM
. , main

" " ( ) .. ..
. .
3 .. ..
..


~

15-12-09, 02:53 PM
;1944331']









:1003:

Blue Girl
15-12-09, 04:54 PM
custmer (name + ID + order )
order (type + number+ status +company+data)



..

15-12-09, 07:06 PM
>>

sosoooo
15-12-09, 08:02 PM
custmer (name + ID + order )
order (type + number+ status +company+data)



..


linked list

queue





sosoooo
15-12-09, 08:11 PM

quize lab


:1002:

Blue Girl
15-12-09, 08:34 PM

linked list

queue


:(

Child Dreams
15-12-09, 09:50 PM
^

(L)

[]
15-12-09, 11:05 PM









()

16-12-09, 12:00 AM

quize lab


:1002:

..

...

..
..

..
:)

sosoooo
17-12-09, 06:24 PM

17-12-09, 07:10 PM
5 >>

Child Dreams
17-12-09, 07:33 PM
#5 :)




Objectives :
Reviewing concept of recursion.
Add recursive functions to linked list ADT.

Part I: Practice Exercises
Exercises 1 : Write a recursive algorithm that returns the number of vowels in a string [array of characters.]
Exercise 2: Write a recursive algorithm that checks whether a string is a palindrome. Your algorithm must returns true if palindrome and false if not. Note that a palindrome string is the string that can be read the same both forward and backward. E.g., madam is palindrome but good is not.
Exercise 3: write a recursive algorithm that prints a string backward.

In all exercises, you have to use appropriate parameters and not to think about global variables.


Part II: Coding Exercise :
Modify the singly linked list ADT to have :
A recursive function that inserts a node at the end of the linked list. (assume that the ADT only has head pointer)
A recursive function that counts the number of nodes in the linked list( assume that there is no "count" variable in the ADT.
Test your functions for integer linked list. Make your program as menu-driven program with the following options:
Insert a new node at the end of the linked list ( call the recursive function)
Print the total number of nodes in the list (call the recursive function)
Print nodes' data.
Good Luck

~

25-12-09, 07:04 PM
210

Haifa Mohammed
25-12-09, 07:07 PM



25-12-09, 07:28 PM

Haifa Mohammed
25-12-09, 07:31 PM
^
^
:D

::

:d

leaf leaflike node

:D

Haifa Mohammed
25-12-09, 07:51 PM
<<


insert recursive

insert Iterative :D

Jo0o0dy
25-12-09, 08:17 PM
( ) ..

<< ..

..

25-12-09, 08:36 PM


Haifa Mohammed
25-12-09, 08:50 PM
:D



:humm:

:humm:

25-12-09, 09:12 PM

25-12-09, 09:24 PM

leaf :::
.... ...

(c ,d ,e, g, h ,i ) ...
internal:::::

.... ( b , f ) internal node

....