Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit4a9155e86f25fe81a2dad91165ed548006f5525f (patch)
Author
 Angel Dimitriev <angel_dimitriev@abv.bg>
2022-05-04 01:22:48 +0300
Committer
 GitHub <noreply@github.com>
2022-05-04 01:22:48 +0300
Filesb7e0ba3ebab42d5f4d868cfcddb2412fe7eabc93
Object-oriented_programming_FMI-4a9155e86f25fe81a2dad91165ed548006f5525f.tar
Object-oriented_programming_FMI-4a9155e86f25fe81a2dad91165ed548006f5525f.tar.gz
Object-oriented_programming_FMI-4a9155e86f25fe81a2dad91165ed548006f5525f.zip
Parent5d5d09286fd6cb20941b9c50d38a4c97e23dd000 (diff)
Update README.md
1 files changed, 31 insertions, 17 deletions
-rw-r--r--Sem. 10/README.md48
diff --git a/Sem. 10/README.md b/Sem. 10/README.md
index b06d4a6..c551ce5 100644
--- a/Sem. 10/README.md
+++ b/Sem. 10/README.md
@@ -124,14 +124,19 @@ int main()
int main()
{
quene<int> q;
- q.enqueue(3);
- q.enqueue(5);
- q.enqueue(10);
+ q.push(3);
+ q.push(5);
+ q.push(10);
- cout << q.dequeue() << endl; //3
- cout << q.dequeue() << endl; //5
- cout << q.dequeue() << endl; //10
+ cout << q.peek() << endl; //3
+ q.pop();
+
+ cout << q.peek() << endl; //5
+ q.pop();
+ cout << q.peek() << endl; //10
+ q.pop();
+
cout << q.isEmpty() << endl; //1
}
```
@@ -143,18 +148,27 @@ int main()
{
kPriorityQueue<char> q(4); // 4 priorities - 0, 1, 2 и 3.
- q.enqueue('A',0): //adds A with lowest priority: 0
- q.enqueue('B',3);
- q.enqueue('C',2);
- q.enqueue('D',2);
- q.enqueue('E',1);
+ q.push('A',0): //adds A with lowest priority: 0
+ q.push('B',3);
+ q.push('C',2);
+ q.push('D',2);
+ q.push('E',1);
+
+ //q.push('F', 5); //error! No such priority!
+
+ q.peek(); // B
+ q.pop();
+
+ q.peek(); // C
+ q.pop();
+
+ q.peek(); // D
+ q.pop();
- //q.enqueue('F', 5); //error! No such priority!
+ q.peek(); // E
+ q.pop();
- q.dequeue(); // B
- q.dequeue(); // C
- q.dequeue(); // D
- q.dequeue(); // E
- q.dequeue(); // A
+ q.peek(); // A
+ q.pop();
}
```