algorithms code

16 flashcardsby Sabs2023
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
algorithm for pushing an item in a stack in psuedocode
FUNCTION is_full(top)
IF top == MAX_SIZE - 1 THEN
RETURN True
ELSE
RETURN False
ENDIF
ENDFUNCTION


FUNCTION push(stack, top, data)
IF is_full(top) == True THEN
PRINT("Stack is full")
ELSE
top = top + 1
stack[top] = data
ENDIF
RETURN top
ENDFUNCTION
2
algorithm for popping an item off a stack
FUNCTION is_empty(top)
IF top == -1 THEN
RETURN True
ELSE
RETURN False
ENDIF
ENDFUNCTION

FUNCTION pop(stack, top)
IF is_empty(top) == True THEN
PRINT ("Stack is empty - nothing to pop")
popped_item = Null
ELSE
popped_item = stack[top]
top = top - 1
ENDIF
RETURN (popped_item, top)
ENDFUNCTION
3
how to enque item in queue
4
how to deque an item in queueu
5
how to traverse a linked list algoirthm
6
how to insert an item in a linked list algorithm(this code for how we implemented list)
7
how to delete nofde (.next = pointer)
8
linear search implentn
9
pre order traversal
10
inorder
11
postorder
12
binary search algorithm
13
bread
14
bubble sort
15
16
merge sort........AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Study all 16 cards for free

More Computer science flashcards

Chapter 9: Network Naming55 cardsComputer science · EnglishManethelCOGS1 Midterm 245 cardsComputer science · EnglishBrycesignals midterm drei yu39 cardsComputer science · EnglishDiandreiSection 6 -Data types 33 cardsComputer science · EnglishDsoboExam 1 (CTEC 302) 27 cardsComputer science · EnglishRayshonDatabase Normalization21 cardsComputer science · English—Griffith—IB Compsci Topic 316 cardsComputer science · Englishnoahmznode.js11 cardsComputer science · GermanInaCS450: Cloud Computing and Security199 cardsComputer science · EnglishWhyOperating System User Accounts and Privileges125 cardsComputer science · EnglishsabMobile Computing: Smartphones and Wearables87 cardsComputer science · EnglishliamLinux Troubleshooting and Commands69 cardsComputer science · EnglishIan

All Computer science decks

Study these decks in the app

Free on iPhone, Android, Mac and the web. Add any deck to your account in one tap.

Download on the App StoreGet it on Google Play
Study all 16 cards for free