Skip to main content

Posts

Showing posts from June, 2025

✅ Solution Implement Both Linear and Binary Search Day 3 DSA with Java

๐Ÿ”น Linear Search in Java public class LinearSearch { public static int linearSearch ( int [] arr, int key) { for ( int i = 0 ; i < arr.length; i++) { if (arr[i] == key) return i; } return - 1 ; // Not found } public static void main (String[] args) { int [] arr = { 5 , 3 , 8 , 2 , 9 }; int key = 8 ; int index = linearSearch(arr, key); System.out.println( "Element found at index: " + index); } } ๐Ÿ”น Binary Search in Java (Iterative) public class BinarySearch { public static int binarySearch ( int [] arr, int key) { int start = 0 , end = arr.length - 1 ; while (start <= end) { int mid = start + (end - start) / 2 ; if (arr[mid] == key) return mid; else if (arr[mid] < key) start = mid + 1 ; else end = mid - 1 ; } return - 1 ; } public static voi...

✅ Day 3: Searching Algorithms in Java

๐ŸŽฏ Goals: Understand Linear Search and Binary Search Learn when and how to use each Solve real interview problems using searching techniques ๐Ÿ” 1. Linear Search ๐Ÿ“˜ Definition: Linearly checks each element one by one. Used when the array is unsorted . ✅ Code Example: public static int linearSearch ( int [] arr, int key) { for ( int i = 0 ; i < arr.length; i++) { if (arr[i] == key) return i; } return - 1 ; // Not found } ๐Ÿง  2. Binary Search ๐Ÿ“˜ Definition: Used on sorted arrays . It divides the search space in half each time — O(log N) time complexity. ✅ Code (Iterative Approach): public static int binarySearch ( int [] arr, int key) { int start = 0 , end = arr.length - 1 ; while (start <= end) { int mid = start + (end - start) / 2 ; if (arr[mid] == key) return mid; else if (arr[mid] < key) start = mid + 1 ; else end = mid - 1 ; } return - 1 ; } ✅ Code (Recu...

๐Ÿงช Practice Problems Answer Day 2 DSA with C

  ✅ 1. Find Maximum and Minimum in an Array # include <stdio.h> int main () { int n, i; int arr[ 100 ], max, min; printf ( "Enter number of elements: " ); scanf ( "%d" , &n); printf ( "Enter %d elements:\n" , n); for (i = 0 ; i < n; i++) { scanf ( "%d" , &arr[i]); } max = min = arr[ 0 ]; for (i = 1 ; i < n; i++) { if (arr[i] > max) max = arr[i]; if (arr[i] < min) min = arr[i]; } printf ( "Maximum: %d\n" , max); printf ( "Minimum: %d\n" , min); return 0 ; } ✅ 2. Count Occurrences of a Given Number # include <stdio.h> int main () { int n, x, count = 0 ; int arr[ 100 ]; printf ( "Enter number of elements: " ); scanf ( "%d" , &n); printf ( "Enter %d elements:\n" , n); for ( int i = 0 ; i < n; i++) { ...

๐Ÿš€ DSA with C – Day 2: Arrays & Linear Search

  ๐ŸŽฏ Goal: Understand arrays in C. Learn how to use loops with arrays . Implement Linear Search algorithm. Practice multiple array-based programs. ๐Ÿง  Theory: What is an Array? An array is a collection of elements stored in contiguous memory . All elements must be of the same type . Indexing starts from 0 in C. ๐Ÿ”ง Declaration and Initialization int arr[ 5 ]; // Declaration int arr[ 5 ] = { 1 , 2 , 3 , 4 , 5 }; // Initialization ๐Ÿ‘จ‍๐Ÿ’ป Basic Program: Input & Output in Arrays # include <stdio.h> int main () { int arr[ 5 ]; printf ( "Enter 5 numbers:\n" ); for ( int i = 0 ; i < 5 ; i++) { scanf ( "%d" , &arr[i]); } printf ( "You entered:\n" ); for ( int i = 0 ; i < 5 ; i++) { printf ( "%d " , arr[i]); } return 0 ; } ๐Ÿ” Linear Search in C ➕ Problem: Given an array and a number x , find if x exists in the array. ✅ Code...

๐Ÿ“ Day 3 Blog Post: "How to Apply to Universities in Singapore – Step-by-Step Guide for 2025"

  ๐Ÿ“ Day 3 Blog Post: "How to Apply to Universities in Singapore – Step-by-Step Guide for 2025" ๐Ÿง  Category: Education > Application & Visa Process ๐Ÿ“† Posting Date: Day 3 ๐Ÿ”‘ SEO Keywords: how to apply to university in Singapore Singapore university admission 2025 study in Singapore for international students NUS/NTU application guide ✅ Title Tag (SEO): How to Apply to Universities in Singapore (NUS, NTU, SMU) – 2025 Guide ๐Ÿ“Œ URL: /apply-singapore-universities-2025 ✍️ Introduction: Singapore is known for its world-class universities, multicultural campus life, and global career opportunities. Whether you're applying to NUS , NTU , SMU , or a polytechnic , this blog will walk you through the step-by-step admission process to study in Singapore in 2025 . ๐Ÿงพ Step-by-Step University Application Guide ๐Ÿ“ Step 1: Choose Your Institution & Course Make a shortlist based on: Program reputation (e.g., NUS for CS, NTU for Engineering) ...

๐Ÿ“ Day 2 Blog Post: "NUS vs NTU: Which University Should You Choose?"

✅ Title: NUS vs NTU: Which Top Singapore University Is Right for You in 2025? ✍️ Introduction: Singapore is home to two world-renowned universities — National University of Singapore (NUS) and Nanyang Technological University (NTU) . Both are globally ranked, highly respected, and offer state-of-the-art facilities. So, how do you choose between them? Let’s break it down and compare NUS and NTU across key factors like ranking, programs, campus life, and career opportunities. ๐Ÿ† 1. Global Rankings Criteria NUS NTU QS World Ranking 2025 #8 globally #26 globally Asia Ranking #1 in Asia #5 in Asia ✅ Conclusion: NUS leads globally and regionally, especially in research and science. ๐Ÿ“š 2. Programs & Strengths NUS Strengths: Computer Science, Business, Law, Life Sciences, Medicine. NTU Strengths: Engineering, Communication Studies, Education, Environmental Sciences. ✅ Conclusion: NUS is broader with strong interdisciplinary programs. NTU is known for engineering a...

๐Ÿ“ Day 1 Blog Post: "Top 10 Courses to Study in Singapore in 2025

  ✍️ Introduction: Singapore has established itself as one of the top education hubs in Asia, offering globally recognized degrees, cutting-edge facilities, and strong industry ties. Whether you're a local student planning your next step or an international student exploring global opportunities, choosing the right course is crucial. Here are the top 10 most in-demand and career-focused courses in Singapore for 2025. ๐ŸŽ“ 1. Computer Science & IT Why it’s popular: Singapore is a digital powerhouse, leading Southeast Asia’s tech growth. Career Options: Software Engineer, Data Scientist, Cybersecurity Analyst. Top Institutions: NUS, NTU, SMU, SIT. ⚙️ 2. Engineering Specializations: Mechanical, Civil, Electrical, Aerospace. Why it’s popular: Infrastructure, sustainability, and smart nation goals. Top Institutions: NTU, SUTD, SIT, NUS. ๐Ÿงฌ 3. Life Sciences & Biotechnology Why it’s popular: Backed by Singapore’s biomedical research ecosystem...

๐Ÿš€ DSA with C – Day 1: Introduction & Setup

  ๐Ÿš€ DSA with C – Day 1: Introduction & Setup ๐ŸŽฏ Goal: Understand what DSA is. Set up your C environment. Write your first C program. Learn about time & space complexity (theory). Practice basic input/output and loops. ๐Ÿง  Theory: What is DSA? Data Structures = Ways to organize and store data efficiently. Algorithms = Step-by-step instructions to solve problems. Why DSA matters: Faster apps, better problem-solving, cracking tech interviews. ๐Ÿ”ง Setup for C Programming Install a C compiler: Windows : Use Code::Blocks or install MinGW and use VS Code. Mac/Linux : Already comes with gcc . Use VS Code or terminal. Create your first .c file. ๐Ÿ‘จ‍๐Ÿ’ป Hello World Program # include <stdio.h> int main () { printf ( "Hello, World!\n" ); return 0 ; } Compile using: gcc hello.c -o hello ./hello ๐Ÿ“š Time & Space Complexity (Intro) Big O Notation (O(n), O(1), etc.) Example: Loop runs n times → ...

Day 2 Java Arrays

✅ Day 2: Arrays – Traversals, Operations & Basic Problems ๐ŸŽฏ Goals of the Day Understand 1D array declaration and initialization in Java Learn array traversal techniques Solve beginner-level problems on arrays ๐Ÿ“˜ 1. Arrays in Java – The Basics An array is a collection of elements of the same type stored in contiguous memory. ๐Ÿ”น Declaration: int [] arr = new int [ 5 ]; // creates an array of size 5 int [] nums = { 1 , 2 , 3 , 4 , 5 }; // directly initialized ๐Ÿ”น Access: System.out.println(arr[ 0 ]); // prints the first element arr[ 2 ] = 10 ; // sets the third element to 10 ๐Ÿ” 2. Traversal of Arrays ๐Ÿ”น Using For Loop: for ( int i = 0 ; i < arr.length; i++) { System.out.println(arr[i]); } ๐Ÿ”น Using Enhanced For Loop: for ( int num : arr) { System.out.println(num); } ✍️ 3. Input in Arrays Scanner sc = new Scanner (System.in); int n = sc.nextInt(); int [] arr = new int [n]; for ( int i ...