Standard Library Array

  • Tipik array’in bir tık daha fonksiyonel olanı.
  • Compile time’da boyutunu belirtmek gerekli (çünkü stack’ta oluşturuluyor(?))
  • Size değişkeni var.
  • Vector gibi fonksiyona atıp, alabiliyoruz
  • .at() ile boundry check yapabiliyor
  • std algoritmalarıyla uyumlu
	array<int, 5> arr{ 1, 3, 5, 7, 9 };
	array<int, 10> arr2;

	fill(arr2.begin(), arr2.end(), 3);

	cout << "arr: \t";
	for (auto i : arr)	cout << i << " ";
	cout << endl;


	cout << "arr2: \t";
	for (auto i : arr2)	cout << i << " ";
	cout << endl << endl;

	cout << "arr.front() : " << arr.front() << endl;
	cout << "arr.back()  : " << arr.back() << endl;
	cout << "arr.empty() : " << arr.empty() << endl;
	cout << "arr.data()  : " << arr.data() << endl;
	
// arr:    1 3 5 7 9
// arr2:   3 3 3 3 3 3 3 3 3 3
//
// arr.front() : 1
// arr.back()  : 9
// arr.empty() : 0
// arr.data()  : 000000B62F2FF4D8

Vector

  • Dinamik olarak allocate edilir. Boyutu runtime’da değişebilir.
  • size ve capacity olmak üzere iki adet boyut değişkeni vardır. Bunlardan size şuanda vector içinde bulunan elemanları gösterirken capacity ise verilen tipte bellekteki ayrılan alanı gösterir. Başka bir şekilde anlatmak gerekirse bir otobüsün kapasitesi 200 kişilik olabilir ama bu durum 200 kişinin otobüste bulunduğu anlamına gelmez. Belki de sadece 30 kişi bulunmakta. Bu durumda size 30 olur.

https://stackoverflow.com/questions/200384/what-is-constant-amortized-time

Forward List

tek taraflı linked list

https://nitishhsinghhh.medium.com/introduction-to-forward-list-in-c-stl-and-important-functions-217fd4d0af59

List

double linked list

https://hackingcpp.com/cpp/std/sequence_containers.html

https://hackingcpp.com/cpp/std/associative_containers.html

List Operations

Deque

Tree Data Structure

Sets

Map

Maps and Insertion

Maps in C++17

Multiset and Multimap

Searching Multimap

Unordered Associative Containers

Associative Containers and Custom Types

Nested Maps

Queues

Priority Queues

Stack

Emplacement

Mastermind Game Practical


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *