< Ace Coding /> πŸš€
337 subscribers
54 photos
2 videos
95 files
66 links
Welcome to Ace Coding! Join us for tips, tutorials, and insights on coding and software engineering. Stay updated with the latest content and elevate your programming skills!Let's learn and grow together in the world of software engineering!
Download Telegram
grokking-algorithms-illustrated-programmers-curious.pdf
24.8 MB
πŸ†πŸš€ Ace Coding: Your DSA Starting Line!

βœ… Just starting out with Data Structures and Algorithms (DSA)? This is the guide you need!

πŸ“š Before diving into dense academic notes, check out this super beginner-friendly, step-by-step resource. Perfect for absolute beginnersβ€”no prior experience needed! It's designed to make learning DSA feel fun and easy.

πŸ’‘ Get ready to build your coding confidence with @AceCoding!
🏁Share and Join for more!!!
πŸ‘2
🚨 Grokking Algorithms is in the building! 🚨

βœ… Both the latest 2023 (MEAP) Edition and the Legacy Editions are here!

I haven't finished it yet, but this book is outstanding. Highly recommend diving in; it’s worth every page.


Get ready to learn algorithms the easy way! πŸŽ‰ With fun visuals and simple explanations, this book makes DSA a breeze. Perfect for beginners or anyone looking to sharpen their skills.

Let’s get grokking! πŸš€βœ¨
πŸš¨πŸ“š Attention DSA Gurus and Pros! πŸ“šπŸš¨

If you’re a master at DSA or looking to sharpen your skills, check out these two MONSTER books! πŸ’ͺπŸ‘Ή

You may already know them, but for those who don’t, let me introduce you! These books are packed with in-depth knowledge and details. πŸ“–βœ¨

Quick tip: Don’t feel like you have to read every pageβ€”use them to brush up on specific topics! There’s no need to finish them cover to cover, or you’ll just end up with too much info to remember. πŸ§ πŸ’¨

Dive in and get ready to level up! πŸš€πŸ”₯

πŸŒŸπŸš€ @AceCoding Presents! πŸš€πŸŒŸ GET THE BOOKSπŸ‘‡
πŸ”₯3πŸ—Ώ1
🌟🀝 Stay Tuned! 🀝🌟

We’re cooking up a storm with exciting news, questions, and super useful resources just for you! πŸ”₯πŸ“š

πŸ”΄Don’t keep it to yourself share the loveπŸ’»!
🟒Spread the word πŸ˜„ to your friends and anyone who could use a boost in their coding journey. Let’s grow together! πŸš€
πŸ‘1😁1
Audio
πŸš€ DSA Intro Audio 🎧

Boost your learning by engaging multiple senses! We’re excited to share a high-quality audio introduction to Data Structures & Algorithms. Perfect for listening anytime, anywhere.

πŸ’‘ Sources:

✨ A2SV notes
πŸ“š Grokking Algorithms
πŸ”‘ Cracking the Coding Interview
πŸ“ Class Notes (Ch. 1 & 2)
πŸ† Codeforces & HackerRank
πŸ’» GeeksForGeeks

πŸ‘‰ Dive in and make studying more immersive and effective! 🌟

πŸŒŸπŸš€ @AceCoding Presents! πŸš€πŸŒŸ
πŸ‘1
< Ace Coding /> πŸš€
https://www.hackerrank.com/challenges/insertionsort1/problem
βœ… First try the question by yourself and then try to compare your solution with mine:
#!/bin/python3

import math
import os
import random
import re
import sys

#
# Complete the 'insertionSort1' function below.
#
# The function accepts following parameters:
# 1. INTEGER n
# 2. INTEGER_ARRAY arr
#

def insertionSort1(n, arr):
# Write your code here
for i in range(n):
j = i
curr = arr[i]
if curr < arr[j-1]:
while j > 0 and curr < arr[j-1]:
arr[j]= arr[j-1]
j-=1
print(*arr)

if j != i:
arr[j] = curr
print(*arr)



if __name__ == '__main__':
n = int(input().strip())

arr = list(map(int, input().rstrip().split()))

insertionSort1(n, arr)
πŸ‘2
βœ…πŸ’» Here is a C++ implementation for the above question.
#include <bits/stdc++.h>

using namespace std;

string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);

/*
* Complete the 'insertionSort1' function below.
*
* The function accepts following parameters:
* 1. INTEGER n
* 2. INTEGER_ARRAY arr
*/

void insertionSort1(int n, vector<int> arr) {
for (int i = 1; i < n; i++) {
int curr = arr[i];
int j = i;

if (curr < arr[j - 1]) {
while (j > 0 && curr < arr[j - 1]) {
arr[j] = arr[j - 1];
j--;

for (int k = 0; k < n; k++) {
cout << arr[k] << " ";
}
cout << endl;
}

if (j != i) {
arr[j] = curr;
for (int k = 0; k < n; k++) {
cout << arr[k] << " ";
}
cout << endl;
}
}
}
}

int main()
{
string n_temp;
getline(cin, n_temp);

int n = stoi(ltrim(rtrim(n_temp)));

string arr_temp_temp;
getline(cin, arr_temp_temp);

vector<string> arr_temp = split(rtrim(arr_temp_temp));

vector<int> arr(n);

for (int i = 0; i < n; i++) {
int arr_item = stoi(arr_temp[i]);

arr[i] = arr_item;
}

insertionSort1(n, arr);

return 0;
}

string ltrim(const string &str) {
string s(str);

s.erase(
s.begin(),
find_if(s.begin(), s.end(), not1(ptr_fun<int, int>(isspace)))
);

return s;
}

string rtrim(const string &str) {
string s(str);

s.erase(
find_if(s.rbegin(), s.rend(), not1(ptr_fun<int, int>(isspace))).base(),
s.end()
);

return s;
}

vector<string> split(const string &str) {
vector<string> tokens;

string::size_type start = 0;
string::size_type end = 0;

while ((end = str.find(" ", start)) != string::npos) {
tokens.push_back(str.substr(start, end - start));

start = end + 1;
}

tokens.push_back(str.substr(start));

return tokens;
}
πŸ‘1
< Ace Coding /> πŸš€
https://www.hackerrank.com/challenges/countingsort1/problem
πŸ’» Solution:
def countingSort(arr):
# Write your code here
count = [0]*100
for n in arr:
count[n] += 1

return count
βœ…C++ version:
vector<int> countingSort(vector<int> arr) {
vector<int> count(100); // arrays connot be returned so make sure to use vectors
for (int i = 0; i < arr.size(); i++){
// for vectors use size() method the length() method works for strings only
count[arr[i]]++;
}
return count;
}
πŸ‘¨β€πŸ’» This question is flagged as EASY on LeetCode, but trust me, it’s the kind of 'easy' that makes you question your life choices. you’ll definitely give it a hard stare. 🀨
Acceptance Rate = 62%

πŸ’¬ If you're new to leetcode don't bother trying to solve it I will share more feasible questions for beginners.


https://leetcode.com/problems/sort-even-and-odd-indices-independently/description/
#LeetCode #DSA #HardEasy