{"id":17491984,"url":"https://github.com/alejandrosuero/algorithm-and-data-structures","last_synced_at":"2025-10-27T18:38:13.548Z","repository":{"id":196982501,"uuid":"697748937","full_name":"AlejandroSuero/algorithm-and-data-structures","owner":"AlejandroSuero","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-28T12:22:22.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T16:55:09.431Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlejandroSuero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-28T11:55:13.000Z","updated_at":"2023-09-28T11:55:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"416015d7-7228-440c-bcfe-1542b7c56f60","html_url":"https://github.com/AlejandroSuero/algorithm-and-data-structures","commit_stats":null,"previous_names":["alejandrosuero/algorithm-and-data-structures"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroSuero%2Falgorithm-and-data-structures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroSuero%2Falgorithm-and-data-structures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroSuero%2Falgorithm-and-data-structures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroSuero%2Falgorithm-and-data-structures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlejandroSuero","download_url":"https://codeload.github.com/AlejandroSuero/algorithm-and-data-structures/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246068302,"owners_count":20718503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-19T08:06:47.255Z","updated_at":"2025-10-27T18:38:08.513Z","avatar_url":"https://github.com/AlejandroSuero.png","language":"TypeScript","readme":"# The last Algorithms Course You'll Need\n\nCourse about algorithms and data structures, tought by @ThePrimeagen (he works\nat Netflix btw) in the\n[FrontendMasters website](https://frontendmasters.com/courses/algorithms).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://theprimeagen.github.io/fem-algos/images/TheStartup.jpeg\" alt=\"ThePrimeagen, CEO of TheStartup™ TryHarder™\" /\u003e\n\u003c/p\u003e\n\n\u003e The course uses TypeScript to show the algorithms and data structures. Learn your types.\n\n```ts\n// Is this an array?\nconst a = [];\n```\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://theprimeagen.github.io/fem-algos/images/morphius.jpg\" alt=\"Morphius what if I told you meme, telling you that const a = []; is not an array\" /\u003e\n\u003c/p\u003e\n\nContents:\n\n- [Big O complexity](#big-o-complexity)\n- [Data Structures](#data-structures)\n- [Algorithms](#algorithms)\n\n## Big O complexity\n\nCategorizes your algorithms time or memory requirements based on input. It's\nnot meant to be a exact measuremnet. It will not tell you how many CPU cycles it\ntakes, instead it is meant to generalize the growth of your algorithm.\n\nExample: When someone says O(n), they mean your algorithm will grow linearly\nbased on input.\n\nEasiest way to tell the Big O complexity, **look for loops**\n\n### O(n)\n\n```ts\nfunction sumCharCodes(n: string): number {\n  let sum = 0;\n  for (let i = 0; i \u003c n.length; ++i) {\n    // every single character in the string\n    sum += n.charCodeAt(i);\n  }\n  return sum;\n}\n```\n\n### O(n^2)\n\n```ts\nfunction sumCharCodes(n: string): number {\n  let sum = 0;\n  for (let i = 0; i \u003c n.length; ++i) {\n    // every single character in the string\n    for (let j = 0; j \u003c n.length; ++j) {\n      // every single character in the string\n      sum += n.charCodeAt(j);\n    }\n  }\n  return sum;\n}\n```\n\n## Data Structures\n\n### Arrays\n\nWell if `const a = []` is not an array, what is it?\n\nAn array is structure that is a contiguous memory space, meaning unbreaking\nmemory space (a certain amount of bytes).\n\n```ts\nconst a = new ArrayBuffer(6);\n// a = ArrayBuffer { [Uint8Contents]: \u003c00 00 00 00 00 00\u003e, byteLength: 6 }\n\nconst a8 = new Uint8Array(a); // creates a view for the array 'a' of 8 bits\na8[0] = 45;\n// a = ArrayBuffer { [Uint8Contents]: \u003c2d 00 00 00 00 00\u003e, byteLength: 6 }\na8[2] = 45;\n// a = ArrayBuffer { [Uint8Contents]: \u003c2d 00 2d 00 00 00\u003e, byteLength: 6 }\n\nconst a16 = new Uint16Array(a); // creates a view for the array 'a' of 16 bits\n// a = ArrayBuffer { [Uint8Contents]: \u003c2d 00 2d 00 00 00\u003e, byteLength: 6 }\na16[2] = 0x4545; // 17733\n// a = ArrayBuffer { [Uint8Contents]: \u003c2d 00 2d 00 45 45\u003e, byteLength: 6 }\n```\n\n\u003e Note: This happens because the firts memory allocations where of 8 bits, so\n\u003e we walked the array in 8 bits positions. But the second time we tried to allocate\n\u003e a 16 bits memory, so we walked the array in 16 bits positions. Meaning that\n\u003e the second position of 8 bits was `\u003c__ 2d __ __ __ __\u003e` while the second\n\u003e position of the 16 bits was `\u003c__ __ __ __ 45 45\u003e`\n\nAn array can't grow, so you can't insert data in it, you can overwrite the data\nin the memory, but this makes it so you cant't go out of bounds and delete other\nmemory information.\n\nThe same for deletion, you don't \"delete\" in an array, you overwrite the memory\nso it contains nothing, like setting it to 0 or null.\n\nArrays:\n\n- Fixed size, contiguous memory chunks\n- You can't grow it\n- There is no \"insertAt\" or push or pop. Although you can write those functions\n  🙄\n\n## Algorithms\n\n### Linear Search\n\nAs the name suggests, it will search in O(n) because worst case, it will search\nthe entire array.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejandrosuero%2Falgorithm-and-data-structures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falejandrosuero%2Falgorithm-and-data-structures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejandrosuero%2Falgorithm-and-data-structures/lists"}