βEssential Data Structures and Algorithms for Coding Interviews
When preparing for coding interviews, understanding data structures and algorithms is crucial. Many interview questions revolve around these concepts, and being proficient can significantly enhance your problem-solving skills.
Below are key data structures, algorithms, and strategies to help you prepare.
βKey Data Structures
1. Arrays
β Description: A collection of elements identified by index or key.
β Common Operations: Access, insert, delete.
β Interview Topics: Two-pointer techniques, sliding window problems.
2. Strings
β Description: A sequence of characters.
β Common Operations: Concatenation, substring search, manipulation.
β Interview Topics: String reversal, anagram checks, palindromes.
3. Linked Lists
β Description: A linear collection of elements (nodes) where each node points to the next.
β Common Operations: Insertions, deletions, traversals.
β Interview Topics: Detecting cycles, reversing linked lists.
4. Stacks
β Description: Follows Last In, First Out (LIFO).
β Common Use Cases: Function calls, expression evaluation.
β Interview Topics: Validating parentheses, next greater element.
5. Queues
β Description: Follows First In, First Out (FIFO).
β Common Use Cases: Task scheduling, breadth-first search.
β Interview Topics: Implementing queues using stacks, circular queues.
6. Hash Tables
β Description: A collection of key-value pairs that allows for fast access.
β Common Operations: Insert, delete, lookup.
β Interview Topics: Counting occurrences, finding duplicates.
7. Trees
β Description: A hierarchical structure consisting of nodes.
β Types: Binary trees, binary search trees (BST), AVL trees, heaps.
β Interview Topics: Tree traversals (in-order, pre-order, post-order), finding lowest common ancestors.
8. Graphs
β Description: A collection of nodes connected by edges.
β Types: Directed vs. undirected, weighted vs. unweighted.
β Interview Topics: Depth-first search (DFS), breadth-first search (BFS), shortest path algorithms (Dijkstra's).
βEssential Algorithms
1. Sorting Algorithms
β Common algorithms include Quick Sort, Merge Sort, and Bubble Sort.
β Understanding time complexity is crucial (e.g., O(n log n) for efficient sorts).
2. Searching Algorithms
β Linear Search vs. Binary Search.
β Binary Search is particularly important for sorted arrays.
3. Dynamic Programming
β A method for solving complex problems by breaking them down into simpler subproblems.
β Common problems include the Fibonacci sequence, knapsack problem, and longest common subsequence.
4. Backtracking
β A technique for solving problems incrementally by trying partial solutions and then abandoning them if they fail to satisfy the criteria.
β Common examples include the N-Queens problem and Sudoku solver.
βPreparation Strategies
1. Practice Coding Problems
β Use platforms like LeetCode, HackerRank, or CodeSignal to practice a variety of problems.
β Focus on problems related to the data structures and algorithms mentioned above.
2. Understand Time and Space Complexity
β Be able to analyze the efficiency of your solutions in terms of Big O notation.
3. Mock Interviews
β Participate in mock interviews with peers or use platforms like Pramp or Interviewing.io to simulate real interview conditions.
4. Study Common Patterns
β Recognize patterns in problems (e.g., two-pointer technique, sliding window) that can help you approach new problems more effectively.
5. Review Past Interview Questions
β Research common interview questions from specific companies to familiarize yourself with their preferred topics and styles.
When preparing for coding interviews, understanding data structures and algorithms is crucial. Many interview questions revolve around these concepts, and being proficient can significantly enhance your problem-solving skills.
Below are key data structures, algorithms, and strategies to help you prepare.
βKey Data Structures
1. Arrays
β Description: A collection of elements identified by index or key.
β Common Operations: Access, insert, delete.
β Interview Topics: Two-pointer techniques, sliding window problems.
2. Strings
β Description: A sequence of characters.
β Common Operations: Concatenation, substring search, manipulation.
β Interview Topics: String reversal, anagram checks, palindromes.
3. Linked Lists
β Description: A linear collection of elements (nodes) where each node points to the next.
β Common Operations: Insertions, deletions, traversals.
β Interview Topics: Detecting cycles, reversing linked lists.
4. Stacks
β Description: Follows Last In, First Out (LIFO).
β Common Use Cases: Function calls, expression evaluation.
β Interview Topics: Validating parentheses, next greater element.
5. Queues
β Description: Follows First In, First Out (FIFO).
β Common Use Cases: Task scheduling, breadth-first search.
β Interview Topics: Implementing queues using stacks, circular queues.
6. Hash Tables
β Description: A collection of key-value pairs that allows for fast access.
β Common Operations: Insert, delete, lookup.
β Interview Topics: Counting occurrences, finding duplicates.
7. Trees
β Description: A hierarchical structure consisting of nodes.
β Types: Binary trees, binary search trees (BST), AVL trees, heaps.
β Interview Topics: Tree traversals (in-order, pre-order, post-order), finding lowest common ancestors.
8. Graphs
β Description: A collection of nodes connected by edges.
β Types: Directed vs. undirected, weighted vs. unweighted.
β Interview Topics: Depth-first search (DFS), breadth-first search (BFS), shortest path algorithms (Dijkstra's).
βEssential Algorithms
1. Sorting Algorithms
β Common algorithms include Quick Sort, Merge Sort, and Bubble Sort.
β Understanding time complexity is crucial (e.g., O(n log n) for efficient sorts).
2. Searching Algorithms
β Linear Search vs. Binary Search.
β Binary Search is particularly important for sorted arrays.
3. Dynamic Programming
β A method for solving complex problems by breaking them down into simpler subproblems.
β Common problems include the Fibonacci sequence, knapsack problem, and longest common subsequence.
4. Backtracking
β A technique for solving problems incrementally by trying partial solutions and then abandoning them if they fail to satisfy the criteria.
β Common examples include the N-Queens problem and Sudoku solver.
βPreparation Strategies
1. Practice Coding Problems
β Use platforms like LeetCode, HackerRank, or CodeSignal to practice a variety of problems.
β Focus on problems related to the data structures and algorithms mentioned above.
2. Understand Time and Space Complexity
β Be able to analyze the efficiency of your solutions in terms of Big O notation.
3. Mock Interviews
β Participate in mock interviews with peers or use platforms like Pramp or Interviewing.io to simulate real interview conditions.
4. Study Common Patterns
β Recognize patterns in problems (e.g., two-pointer technique, sliding window) that can help you approach new problems more effectively.
5. Review Past Interview Questions
β Research common interview questions from specific companies to familiarize yourself with their preferred topics and styles.
β€1
Dear Sir/Madam,
Greetings from Innomatics Research Labs!
We are pleased to inform you that Infosys BPM, in association with Live Connections (Hiring Partner), is conducting a Mega Off-Campus Drive in Pune for multiple roles across technical and non-technical domains.
We kindly request you to circulate this opportunity among eligible students from your institution.
π Job Roles:
β’ Service Desk β L1 Support
β’ Customer Support
π― Registration Link:
https://forms.gle/ggfngc5tnMVzfAoYA
π Eligible Branches:
β’ BE / BTech / BCA / BCom / BBA / BBM
π Eligible Passout Years:
β’ 2023, 2024, 2025 & 2026
π Drive Venue:
Innomatics Research Labs β Pune
Sai Sayaji Apartment, 201
(Beside VANAZ Metro, Above Bata Showroom)
Ramkrishna Paramhans Nagar,
Kothrud, Pune, Maharashtra
π Google Maps Location:
https://maps.app.goo.gl/DvsKrpawJY1okgkZ7
π Important Note:
Selected candidates must undergo 2 months of mandatory training at the Infosys Office in Mysore before deployment.
We highly appreciate your support in sharing this opportunity with students.
Infosys - Mega Off Campus Drive.jpeg
Thanks & Regards,
Anshul Kanase
Manager - Academic/University Partnership
anshul.kanase@innomatics.in | +91-9028069535
Innomatics Research Labs | www.innomatics.in
"Transforming careers...Transforming Lives"
Greetings from Innomatics Research Labs!
We are pleased to inform you that Infosys BPM, in association with Live Connections (Hiring Partner), is conducting a Mega Off-Campus Drive in Pune for multiple roles across technical and non-technical domains.
We kindly request you to circulate this opportunity among eligible students from your institution.
π Job Roles:
β’ Service Desk β L1 Support
β’ Customer Support
π― Registration Link:
https://forms.gle/ggfngc5tnMVzfAoYA
π Eligible Branches:
β’ BE / BTech / BCA / BCom / BBA / BBM
π Eligible Passout Years:
β’ 2023, 2024, 2025 & 2026
π Drive Venue:
Innomatics Research Labs β Pune
Sai Sayaji Apartment, 201
(Beside VANAZ Metro, Above Bata Showroom)
Ramkrishna Paramhans Nagar,
Kothrud, Pune, Maharashtra
π Google Maps Location:
https://maps.app.goo.gl/DvsKrpawJY1okgkZ7
π Important Note:
Selected candidates must undergo 2 months of mandatory training at the Infosys Office in Mysore before deployment.
We highly appreciate your support in sharing this opportunity with students.
Infosys - Mega Off Campus Drive.jpeg
Thanks & Regards,
Anshul Kanase
Manager - Academic/University Partnership
anshul.kanase@innomatics.in | +91-9028069535
Innomatics Research Labs | www.innomatics.in
"Transforming careers...Transforming Lives"
π 5 FREE MICROSOFT COURSES & CERTIFICATES (2026) π₯
Upgrade your skills with these FREE Microsoft courses & earn certificates to boost your resume πΌβ¨
βββββββββββββββ
1οΈβ£ Microsoft AI Skills Challenge π€
Learn AI tools, Copilot & AI workflows
π https://learn.microsoft.com/en-us/training/ai/
βββββββββββββββ
2οΈβ£ Azure Fundamentals (AZ-900) βοΈ
Start cloud computing with Microsoft Azure
π Certification:
https://learn.microsoft.com/en-us/certifications/azure-fundamentals/
π Free Training:
https://learn.microsoft.com/en-us/training/paths/microsoft-azure-fundamentals-describe-cloud-concepts/
βββββββββββββββ
3οΈβ£ Microsoft Cybersecurity Course π
Learn cybersecurity, protection & security basics
π https://learn.microsoft.com/en-us/training/career-paths/cybersecurity/
βββββββββββββββ
4οΈβ£ Power BI Data Analytics π
Learn dashboards, analytics & data visualization
π https://learn.microsoft.com/en-us/training/powerplatform/power-bi/
βββββββββββββββ
5οΈβ£ Microsoft Web Development Course π»
Learn HTML, CSS & JavaScript basics
π https://learn.microsoft.com/en-us/training/career-paths/web-development/
βββββββββββββββ
π― Free certificates
π― Beginner friendly
π― In-demand 2026 skills
π― Resume boosting courses
π Save these links & share with your friends
π Follow @cscorner for more free courses, AI tools & tech opportunities π₯
Upgrade your skills with these FREE Microsoft courses & earn certificates to boost your resume πΌβ¨
βββββββββββββββ
1οΈβ£ Microsoft AI Skills Challenge π€
Learn AI tools, Copilot & AI workflows
π https://learn.microsoft.com/en-us/training/ai/
βββββββββββββββ
2οΈβ£ Azure Fundamentals (AZ-900) βοΈ
Start cloud computing with Microsoft Azure
π Certification:
https://learn.microsoft.com/en-us/certifications/azure-fundamentals/
π Free Training:
https://learn.microsoft.com/en-us/training/paths/microsoft-azure-fundamentals-describe-cloud-concepts/
βββββββββββββββ
3οΈβ£ Microsoft Cybersecurity Course π
Learn cybersecurity, protection & security basics
π https://learn.microsoft.com/en-us/training/career-paths/cybersecurity/
βββββββββββββββ
4οΈβ£ Power BI Data Analytics π
Learn dashboards, analytics & data visualization
π https://learn.microsoft.com/en-us/training/powerplatform/power-bi/
βββββββββββββββ
5οΈβ£ Microsoft Web Development Course π»
Learn HTML, CSS & JavaScript basics
π https://learn.microsoft.com/en-us/training/career-paths/web-development/
βββββββββββββββ
π― Free certificates
π― Beginner friendly
π― In-demand 2026 skills
π― Resume boosting courses
π Save these links & share with your friends
π Follow @cscorner for more free courses, AI tools & tech opportunities π₯
Docs
Microsoft Certified: Azure Fundamentals - Certifications
Demonstrate foundational knowledge of cloud concepts, core Azure services, plus Azure management and governance features and tools.
π *Data Science vs Big Data β Two powerful fields, one shared goal: turning data into value* .
π Data Science focuses on insights, prediction, and decision-making using Statistics, ML, and Visualization.
β‘ Big Data focuses on storing, processing, and managing massive datasets using scalable systems like Hadoop, Spark, and Kafka.
π‘ *In simple terms* :
β’ Big Data builds the infrastructure
β’ Data Science extracts the intelligence
π Choose Data Science if you enjoy analytics & AI
π Choose Big Data if you enjoy systems & scalability
π The future belongs to professionals who understand both.
π Data Science focuses on insights, prediction, and decision-making using Statistics, ML, and Visualization.
β‘ Big Data focuses on storing, processing, and managing massive datasets using scalable systems like Hadoop, Spark, and Kafka.
π‘ *In simple terms* :
β’ Big Data builds the infrastructure
β’ Data Science extracts the intelligence
π Choose Data Science if you enjoy analytics & AI
π Choose Big Data if you enjoy systems & scalability
π The future belongs to professionals who understand both.
π1
Opening for the Post of Software/Application Support Executive (Male Candidates) background.
Key Accountabilities:
Installation and implementation of software at client site. Providing training to users, Addressing & Resolving queries. Managing ticketed query system and reporting status of Queries and Resolutions.
Desired Candidate Profile
Education:
1. Any Graduate
2. Presentable with Good Communications Skills
3. Dedication for Customer Service
4. Ability & Keenness to Understand/Learn New System Processes and Technologies and work under pressure to handle sensitive/critical situations
5. Basic Working knowledge of Accounts, Server OS, MSSQL & Networking
Experience: Freshers
Salary Rs 17,500 + Travelling Allowance
Email your resume to jobs@eshowbizz.com.
OR
WhatsApp your resume on +91 9920138859.
Professional eSolutions (I) Pvt. Ltd., Unit No. 118, Andheri Universal Industrial Estate, Plot No. 57, J.P. Road, Andheri (West), Mumbai-400 058.
Key Accountabilities:
Installation and implementation of software at client site. Providing training to users, Addressing & Resolving queries. Managing ticketed query system and reporting status of Queries and Resolutions.
Desired Candidate Profile
Education:
1. Any Graduate
2. Presentable with Good Communications Skills
3. Dedication for Customer Service
4. Ability & Keenness to Understand/Learn New System Processes and Technologies and work under pressure to handle sensitive/critical situations
5. Basic Working knowledge of Accounts, Server OS, MSSQL & Networking
Experience: Freshers
Salary Rs 17,500 + Travelling Allowance
Email your resume to jobs@eshowbizz.com.
OR
WhatsApp your resume on +91 9920138859.
Professional eSolutions (I) Pvt. Ltd., Unit No. 118, Andheri Universal Industrial Estate, Plot No. 57, J.P. Road, Andheri (West), Mumbai-400 058.
https://www.instagram.com/reel/DYtwcqGKaAc/?igsh=MWs0OXMzenBpdWU3ag==
My 19 yrs of Java Journeyβ€π₯
My 19 yrs of Java Journeyβ€π₯
Code with Harry - 100 days
https://www.youtube.com/playlist?list=PLu0W_9lII9agwh1XjRt242xIpHhPT2llg
Campus X - 100 days
https://www.youtube.com/playlist?list=PLKnIA16_Rmvb1RYR-iTA_hzckhdONtSW4
London App Brewery - 100 days
https://www.youtube.com/playlist?list=PLSzsOkUDsvdvGZ2fXGizY_Iz9j8-ZlLqh
Chai aur code - 10 hrs
https://www.youtube.com/watch?v=v9bOWjwdTlg
Free code camp - 4hrs
https://www.youtube.com/watch?v=eWRfhZUzrAc
https://www.youtube.com/playlist?list=PLu0W_9lII9agwh1XjRt242xIpHhPT2llg
Campus X - 100 days
https://www.youtube.com/playlist?list=PLKnIA16_Rmvb1RYR-iTA_hzckhdONtSW4
London App Brewery - 100 days
https://www.youtube.com/playlist?list=PLSzsOkUDsvdvGZ2fXGizY_Iz9j8-ZlLqh
Chai aur code - 10 hrs
https://www.youtube.com/watch?v=v9bOWjwdTlg
Free code camp - 4hrs
https://www.youtube.com/watch?v=eWRfhZUzrAc
*β
Linear Regression Basics ππ€*
π This is the most important and beginner-friendly algorithm in Machine Learning.
*πΉ 1. What is Linear Regression?*
Linear Regression is used to predict a continuous value.
π Example:
β Predict salary
β Predict house price
β Predict sales
*π₯ 2. Basic Idea*
π It finds a straight line that best fits the data.
Equation:
y = mx + c
Where:
β y β Output (target)
β x β Input (feature)
β m β Slope
β c β Intercept
*πΉ 3. Example*
π Predict Salary based on Experience
Experience Salary
1 year 20k
2 years 30k
3 years 40k
π Model learns pattern β predicts future salary.
*πΉ 4. Simple Implementation (Python)*
from sklearn.linear_model import LinearRegression
# Sample data
X = [[1], [2], [3]]
y = [20000, 30000, 40000]
model = LinearRegression()
model.fit(X, y)
# Prediction
print(model.predict([[4]]))
π Output: βΌ50000 (approx)
*πΉ 5. Important Terms β*
β Feature (X) β Input
β Target (y) β Output
β Model β Learns relationship
β Prediction β Output from model
*πΉ 6. Assumptions of Linear Regression*
β Linear relationship
β No extreme outliers
β Independent features
*πΉ 7. Why Linear Regression is Important?*
β Easy to understand
β Used in real-world predictions
β Foundation for advanced ML
*π― Todayβs Goal*
β Understand regression concept
β Learn equation (y = mx + c)
β Implement simple model
π Linear Regression = First step into ML modeling π
π¬ *Tap β€οΈ for more!*
π This is the most important and beginner-friendly algorithm in Machine Learning.
*πΉ 1. What is Linear Regression?*
Linear Regression is used to predict a continuous value.
π Example:
β Predict salary
β Predict house price
β Predict sales
*π₯ 2. Basic Idea*
π It finds a straight line that best fits the data.
Equation:
y = mx + c
Where:
β y β Output (target)
β x β Input (feature)
β m β Slope
β c β Intercept
*πΉ 3. Example*
π Predict Salary based on Experience
Experience Salary
1 year 20k
2 years 30k
3 years 40k
π Model learns pattern β predicts future salary.
*πΉ 4. Simple Implementation (Python)*
from sklearn.linear_model import LinearRegression
# Sample data
X = [[1], [2], [3]]
y = [20000, 30000, 40000]
model = LinearRegression()
model.fit(X, y)
# Prediction
print(model.predict([[4]]))
π Output: βΌ50000 (approx)
*πΉ 5. Important Terms β*
β Feature (X) β Input
β Target (y) β Output
β Model β Learns relationship
β Prediction β Output from model
*πΉ 6. Assumptions of Linear Regression*
β Linear relationship
β No extreme outliers
β Independent features
*πΉ 7. Why Linear Regression is Important?*
β Easy to understand
β Used in real-world predictions
β Foundation for advanced ML
*π― Todayβs Goal*
β Understand regression concept
β Learn equation (y = mx + c)
β Implement simple model
π Linear Regression = First step into ML modeling π
π¬ *Tap β€οΈ for more!*
β€2
*Data Handling Basics Part 1: NumPy (Numerical Computing in Python)* π’
NumPy is one of the most important libraries for:
- Data science
- Machine learning
- Scientific computing
- Data analytics
It provides fast mathematical operations on arrays.
*1οΈβ£ Install NumPy*
pip install numpy
*2οΈβ£ Import NumPy*
import numpy as np
np is the standard alias.
*3οΈβ£ Create NumPy Array*
import numpy as np
arr = np.array([1, 2, 3, 4])
print(arr)
Output: [1 2 3 4]
*4οΈβ£ NumPy vs Python List*
Python list:
a = [1,2,3]
b = [4,5,6]
print(a + b)
Output: [1,2,3,4,5,6]
NumPy array:
import numpy as np
a = np.array([1,2,3])
b = np.array([4,5,6])
print(a + b)
Output: [5 7 9]
NumPy performs element-wise operations.
*5οΈβ£ Basic Array Operations*
import numpy as np
arr = np.array([1,2,3,4])
print(arr + 10)
print(arr * 2)
Output:
[11 12 13 14]
[2 4 6 8]
*6οΈβ£ Useful NumPy Functions*
import numpy as np
arr = np.array([1,2,3,4])
print(np.mean(arr))
print(np.sum(arr))
print(np.max(arr))
print(np.min(arr))
Output example:
2.5
10
4
1
*7οΈβ£ Create Special Arrays*
- Zeros array:
- Ones array:
- Range array:
*8οΈβ£ 2D Arrays (Matrices)*
import numpy as np
arr = np.array([
[1,2,3],
[4,5,6]
])
print(arr)
Access element:
Output: 2
*Real Example: Student Marks Analysis*
import numpy as np
marks = np.array([78,85,90,66,72])
print("Average:", np.mean(marks))
print("Highest:", np.max(marks))
print("Lowest:", np.min(marks))
*Practice Tasks*
1. Create NumPy array of numbers 1β10
2. Add 5 to every element
3. Find mean and sum of array
4. Create 3Γ3 matrix
5. Find maximum value in array
*β Practice Task Solutions β NumPy Basics*
*Task 1. Create NumPy array of numbers 1β10*
import numpy as np
arr = np.arange(1, 11)
print(arr)
Output: [1 2 3 4 5 6 7 8 9 10]
*Task 2. Add 5 to every element*
import numpy as np
arr = np.arange(1, 11)
result = arr + 5
print(result)
Output: [ 6 7 8 9 10 11 12 13 14 15]
*Task 3. Find mean and sum of array*
import numpy as np
arr = np.array([1,2,3,4,5])
print("Sum:", np.sum(arr))
print("Mean:", np.mean(arr))
Output example:
Sum: 15
Mean: 3.0
*Task 4. Create 3Γ3 matrix*
import numpy as np
matrix = np.array([
[1,2,3],
[4,5,6],
[7,8,9]
])
print(matrix)
Output:
[[1 2 3]
[4 5 6]
[7 8 9]]
*Task 5. Find maximum value in array*
import numpy as np
arr = np.array([12,45,7,89,34])
print("Maximum:", np.max(arr))
Output: Maximum: 89
*β Key learning*
- np.arange() β create range arrays
- NumPy supports vectorized operations
- np.mean() β average
- np.sum() β total
- np.max() β largest value
*Double Tap β₯οΈ For More*
NumPy is one of the most important libraries for:
- Data science
- Machine learning
- Scientific computing
- Data analytics
It provides fast mathematical operations on arrays.
*1οΈβ£ Install NumPy*
pip install numpy
*2οΈβ£ Import NumPy*
import numpy as np
np is the standard alias.
*3οΈβ£ Create NumPy Array*
import numpy as np
arr = np.array([1, 2, 3, 4])
print(arr)
Output: [1 2 3 4]
*4οΈβ£ NumPy vs Python List*
Python list:
a = [1,2,3]
b = [4,5,6]
print(a + b)
Output: [1,2,3,4,5,6]
NumPy array:
import numpy as np
a = np.array([1,2,3])
b = np.array([4,5,6])
print(a + b)
Output: [5 7 9]
NumPy performs element-wise operations.
*5οΈβ£ Basic Array Operations*
import numpy as np
arr = np.array([1,2,3,4])
print(arr + 10)
print(arr * 2)
Output:
[11 12 13 14]
[2 4 6 8]
*6οΈβ£ Useful NumPy Functions*
import numpy as np
arr = np.array([1,2,3,4])
print(np.mean(arr))
print(np.sum(arr))
print(np.max(arr))
print(np.min(arr))
Output example:
2.5
10
4
1
*7οΈβ£ Create Special Arrays*
- Zeros array:
np.zeros(5)- Ones array:
np.ones(4)- Range array:
np.arange(1,10)*8οΈβ£ 2D Arrays (Matrices)*
import numpy as np
arr = np.array([
[1,2,3],
[4,5,6]
])
print(arr)
Access element:
print(arr[0,1])Output: 2
*Real Example: Student Marks Analysis*
import numpy as np
marks = np.array([78,85,90,66,72])
print("Average:", np.mean(marks))
print("Highest:", np.max(marks))
print("Lowest:", np.min(marks))
*Practice Tasks*
1. Create NumPy array of numbers 1β10
2. Add 5 to every element
3. Find mean and sum of array
4. Create 3Γ3 matrix
5. Find maximum value in array
*β Practice Task Solutions β NumPy Basics*
*Task 1. Create NumPy array of numbers 1β10*
import numpy as np
arr = np.arange(1, 11)
print(arr)
Output: [1 2 3 4 5 6 7 8 9 10]
*Task 2. Add 5 to every element*
import numpy as np
arr = np.arange(1, 11)
result = arr + 5
print(result)
Output: [ 6 7 8 9 10 11 12 13 14 15]
*Task 3. Find mean and sum of array*
import numpy as np
arr = np.array([1,2,3,4,5])
print("Sum:", np.sum(arr))
print("Mean:", np.mean(arr))
Output example:
Sum: 15
Mean: 3.0
*Task 4. Create 3Γ3 matrix*
import numpy as np
matrix = np.array([
[1,2,3],
[4,5,6],
[7,8,9]
])
print(matrix)
Output:
[[1 2 3]
[4 5 6]
[7 8 9]]
*Task 5. Find maximum value in array*
import numpy as np
arr = np.array([12,45,7,89,34])
print("Maximum:", np.max(arr))
Output: Maximum: 89
*β Key learning*
- np.arange() β create range arrays
- NumPy supports vectorized operations
- np.mean() β average
- np.sum() β total
- np.max() β largest value
*Double Tap β₯οΈ For More*
β€1