A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d7/d00/list__array_8cpp.html below:

TheAlgorithms/C++: data_structures/list_array.cpp File Reference

Loading...

Searching...

No Matches

Dynamic Array More...

#include <array>
#include <cassert>
#include <cstdint>
#include <iostream>

Go to the source code of this file.

static void  test ()   Test implementations.
int  main ()   Main function.

Dynamic Array

The list_array is the implementation of list represented using array. We can perform basic CRUD operations as well as other operations like sorting etc.

Algorithm

It implements various method like insert, sort, search etc. efficiently. You can select the operation and methods will do the rest work for you. You can insert element, sort them in order, search efficiently, delete values and print the list.

Definition in file list_array.cpp.

◆ main()

Main function.

Returns
0 on exit

Definition at line 260 of file list_array.cpp.

260 {

262 return 0;

263}

static void test()

Test implementations.

◆ test()

Test implementations.

Returns
void

Definition at line 218 of file list_array.cpp.

218 {

220

221

224 assert(L.top == 2);

230 assert(L.top == 7);

232

233

236 assert(L.top == 5);

238 assert(L.top == 5);

239

240

241 assert(L.search(11) == 0);

242 assert(L.search(12) == 2);

243 assert(L.search(50) == -1);

244

245

247 assert(L.isSorted == true);

249

250

251 assert(L.search(11) == 1);

252 assert(L.search(12) == 2);

253 assert(L.search(50) == -1);

254}

Structure of List with supporting methods.

void show()

Utility function to print array.

void sort()

Sort the list.

void remove(const uint64_t &val)

To remove the element from the list.

void insert(const uint64_t &val)

Insert the new element in the list.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4