CoboCards App FAQ & Wishes Feedback
Language: English Language
Sign up for free  Login

This flashcard is just one of a free flashcard set. See all flashcards!

All main topics / Informatik / Algorithmen und Datenstrukturen / Datenstrukturen
8
Beschreibe die Funktionen size(), isEmpty() und enqueue(), dequeue mit Exceptions bei einer Queuelänge von N!
Algorithm size()
return (N-f+r) mod N

Algorithm isEmpty()
return (f==r)

Algorithm enqueue(o)
if size() = N − 1 then throw FullQueueException
else Q[r] ← o r ← (r + 1) mod N

Algorithm dequeue()
if isEmpty() then throw EmptyQueueException
else
o ← Q[f]
f ← (f + 1) mod N
return o
New comment
Flashcard info:
Author: robthemobb
Main topic: Informatik
Topic: Algorithmen und Datenstrukturen
Published: 05.03.2010

Cancel
Email

Password

Login    

Forgot password?
Deutsch  English