The Self-Taught Computer Scientist


Download 1.48 Mb.
Pdf ko'rish
bet99/147
Sana17.06.2023
Hajmi1.48 Mb.
#1540634
1   ...   95   96   97   98   99   100   101   102   ...   147
Bog'liq
books-library.net-11301817Az7X6

stack: An abstract data type and a linear data structure that allows you to remove only the most 
recent element you added.
last in, first out data structure: A data structure where the last item you put into the data structure 
is the first item to come out of it.
limited- access data structure: A type of data structure that forces you to access its information in 
a particular order.
pushing: Putting a new item onto a stack.
popping: Removing the last item from a stack.
peeking: Looking at the top element in a stack without removing it.
bounded stack: A stack that limits how many items you can add to it.
unbounded stack: A stack that does not limit how many items you can add to it.
Challenges
1. 
Modify your balanced string program to check whether both parentheses
()
, and brackets, 
{}

are balanced in a string.
2. 
Design a max stack that allows you to push, pop, and keep track of your stack’s biggest number 
in O(1) time.



12
Queues
All students should have the opportunity to learn how to program. Computer science is the basis for 
modern day creativity and expression. The computer programmers of tomorrow will revolu-
tionize medicine.
Anne Wojcicki
queue is an abstract data type and a linear data structure where you can add items only to the 
rear and remove them from the front (Figure 12.1). The queue abstract data type describes a data 
structure that works like the checkout lines at a grocery store: the first person in the line is the first 
person to check out, and newcomers join the line’s rear.
A queue is an example of a first- in, first- out (FIFO) data structure. As the name implies, in a first- in, 

Download 1.48 Mb.

Do'stlaringiz bilan baham:
1   ...   95   96   97   98   99   100   101   102   ...   147




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling