fa
Feedback
Tech Jargon - Decoded

Tech Jargon - Decoded

رفتن به کانال در Telegram

Confused by tech terms? Don’t worry, we’ve got you 🤝 We make things simple, one concept at a time. Learn daily Easy & clear Turn Confusion into clarity. #tech #it #softwareengineer #cs #development

نمایش بیشتر
2 018
مشترکین
اطلاعاتی وجود ندارد24 ساعت
-77 روز
-4030 روز
آرشیو پست ها
What is load balancing? Load balancing is the process of distributing incoming network traffic across a group of backend servers. It acts as a traffic controller sitting in front of your servers, routing client requests to ensure no single server gets overloaded. The system monitors the health of each server in the group. If one server fails or becomes too busy, the load balancer automatically redirects the data to the remaining functional servers. This prevents crashes and ensures the workload is shared equally among all available hardware.

What is Backend Development? Backend development refers to the server-side logic of an application. It is the part of the software that remains hidden from the user but is responsible for making everything work. The backend consists of a server, an application, and a database. When a frontend sends a request, the backend processes that request by executing specific scripts, communicating with the database to store or retrieve data, and then sending a response back to the user interface. It handles all the heavy lifting, security checks, and data management.

*Blind 75 LeetCode Problem Solving Challenge* Starts tomorrow, Daily practice(1 or 2 problems) Consistent progress Learn with
*Blind 75 LeetCode Problem Solving Challenge* Starts tomorrow, Daily practice(1 or 2 problems) Consistent progress Learn with community Join Now: 👉https://t.me/learndsawithai

💻 ArrayDeque Operations
// Code not available
📤 Output:
// Code not available

💻 PriorityQueue Operations
// Code not available
📤 Output:
// Code not available

Collections Framework - Queue

💻 IdentityHashMap Operations
// Code not available
📤 Output:
// Code not available

💻 WeakHashMap Operations
// Code not available
📤 Output:
// Code not available

💻 ConcurrentHashMap Operations
// Code not available
📤 Output:
// Code not available

💻 Sort Map by Value
// Code not available
📤 Output:
// Code not available

💻 Sort Map by Key
// Code not available
📤 Output:
// Code not available

💻 Map Entry Iteration
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class MapEntryIteration {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        Map<String, Integer> studentMarks = new HashMap<>();

        System.out.print("Enter the number of students: ");
        int numberOfStudents = scanner.nextInt();
        scanner.nextLine(); // Consume newline

        for (int i = 0; i < numberOfStudents; i++) {
            System.out.print("Enter student name: ");
            String studentName = scanner.nextLine();
            System.out.print("Enter marks for " + studentName + ": ");
            int marks = scanner.nextInt();
            scanner.nextLine(); // Consume newline
            studentMarks.put(studentName, marks);
        }

        System.out.println("nIterating through Map Entries:");
        for (Map.Entry<String, Integer> entry : studentMarks.entrySet()) {
            String studentName = entry.getKey();
            int marks = entry.getValue();
            System.out.println("Student: " + studentName + ", Marks: " + marks);
        }

        scanner.close();
    }
}
📤 Output:
Input: 2
Input: Alice
Input: 85
Input: Bob
Input: 92
Output: Enter the number of students: Enter student name: Enter marks for Alice: Enter student name: Enter marks for Bob:
Iterating through Map Entries:
Student: Alice, Marks: 85
Student: Bob, Marks: 92

Enter your choice: Input: 4 Enter Roll Number to check: Input: 102 Output: Roll Number exists. Enter your choice: Input: 4 Enter Roll Number to check: Input: 104 Output: Roll Number does not exist. Enter your choice: Input: 5 Output: Student Details: Output: Roll Number: 102, Name: Bob Output: Roll Number: 101, Name: Alice Enter your choice: Input: 3 Enter Roll Number to remove: Input: 101 Output: Student removed successfully! Enter your choice: Input: 5 Output: Student Details: Output: Roll Number: 102, Name: Bob Enter your choice: Input: 6 Output: Exiting... ``` _(Part 2/2)_

💻 Hashtable Operations import java.util.Hashtable; import java.util.Scanner; public class HashtableOperations { public static void main(String[] args) { Hashtable<Integer, String> studentTable = new Hashtable<>(); Scanner scanner = new Scanner(System.in); System.out.println("Hashtable Operations:"); System.out.println("1. Add Student"); System.out.println("2. Get Student Name by Roll Number"); System.out.println("3. Remove Student"); System.out.println("4. Check if Roll Number Exists"); System.out.println("5. Display all entries"); System.out.println("6. Exit"); int choice; do { System.out.print("Enter your choice: "); choice = scanner.nextInt(); scanner.nextLine(); switch (choice) { case 1: System.out.print("Enter Roll Number: "); int rollNumber = scanner.nextInt(); scanner.nextLine(); System.out.print("Enter Student Name: "); String studentName = scanner.nextLine(); studentTable.put(rollNumber, studentName); System.out.println("Student added successfully!"); break; case 2: System.out.print("Enter Roll Number to search: "); int searchRollNumber = scanner.nextInt(); scanner.nextLine(); String name = studentTable.get(searchRollNumber); if (name != null) { System.out.println("Student Name: " + name); } else { System.out.println("Student not found."); } break; case 3: System.out.print("Enter Roll Number to remove: "); int removeRollNumber = scanner.nextInt(); scanner.nextLine(); studentTable.remove(removeRollNumber); System.out.println("Student removed successfully!"); break; case 4: System.out.print("Enter Roll Number to check: "); int checkRollNumber = scanner.nextInt(); scanner.nextLine(); if (studentTable.containsKey(checkRollNumber)) { System.out.println("Roll Number exists."); } else { System.out.println("Roll Number does not exist."); } break; case 5: if (studentTable.isEmpty()) { System.out.println("Hashtable is empty."); } else { System.out.println("Student Details:"); studentTable.forEach((roll, name1) -> System.out.println("Roll Number: " + roll + ", Name: " + name1)); } break; case 6: System.out.println("Exiting..."); break; default: System.out.println("Invalid choice. Please try again."); } } while (choice != 6); scanner.close(); } } 📤 Output: ``` Hashtable Operations: 1. Add Student 2. Get Student Name by Roll Number 3. Remove Student 4. Check if Roll Number Exists 5. Display all entries 6. Exit Enter your choice: Input: 1 Enter Roll Number: Input: 101 Enter Student Name: Input: Alice Output: Student added successfully! Enter your choice: Input: 1 Enter Roll Number: Input: 102 Enter Student Name: Input: Bob Output: Student added successfully! Enter your choice: Input: 2 Enter Roll Number to search: Input: 101 Output: Student Name: Alice Enter your choice: Input: 2 Enter Roll Number to search: Input: 103 Output: Student not found. _(Part 1/2)_

💻 TreeMap Operations
import java.util.TreeMap;
import java.util.Scanner;

public class TreeMapOperations {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        TreeMap<Integer, String> studentMap = new TreeMap<>();

        System.out.println("Enter the number of students:");
        int numberOfStudents = scanner.nextInt();
        scanner.nextLine();

        for (int i = 0; i < numberOfStudents; i++) {
            System.out.println("Enter roll number:");
            int rollNumber = scanner.nextInt();
            scanner.nextLine();
            System.out.println("Enter name:");
            String name = scanner.nextLine();
            studentMap.put(rollNumber, name);
        }

        System.out.println("Student Details (Sorted by Roll Number):");
        for (Integer rollNumber : studentMap.keySet()) {
            System.out.println("Roll Number: " + rollNumber + ", Name: " + studentMap.get(rollNumber));
        }

        System.out.println("Enter a roll number to search:");
        int searchRollNumber = scanner.nextInt();

        if (studentMap.containsKey(searchRollNumber)) {
            System.out.println("Name of student with roll number " + searchRollNumber + " is: " + studentMap.get(searchRollNumber));
        } else {
            System.out.println("Student with roll number " + searchRollNumber + " not found.");
        }

        scanner.close();
    }
}
📤 Output:
Input: 3
Input: 101
Input: Alice
Input: 103
Input: Bob
Input: 102
Input: Charlie
Output: Enter the number of students:
Output: Enter roll number:
Output: Enter name:
Output: Enter roll number:
Output: Enter name:
Output: Enter roll number:
Output: Enter name:
Output: Student Details (Sorted by Roll Number):
Output: Roll Number: 101, Name: Alice
Output: Roll Number: 102, Name: Charlie
Output: Roll Number: 103, Name: Bob
Output: Enter a roll number to search:
Input: 102
Output: Name of student with roll number 102 is: Charlie

💻 LinkedHashMap Operations
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;

public class LinkedHashMapOperations {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // Creating a LinkedHashMap
        LinkedHashMap<String, Integer> studentMarks = new LinkedHashMap<>();

        // Adding elements to the LinkedHashMap
        studentMarks.put("Alice", 85);
        studentMarks.put("Bob", 92);
        studentMarks.put("Charlie", 78);
        studentMarks.put("David", 95);

        System.out.println("Initial LinkedHashMap: " + studentMarks);

        // Getting a value using a key
        System.out.print("Enter student name to get marks: ");
        String studentName = scanner.nextLine();
        Integer marks = studentMarks.get(studentName);
        if (marks != null) {
            System.out.println(studentName + "'s marks: " + marks);
        } else {
            System.out.println("Student not found.");
        }

        // Checking if a key exists
        System.out.print("Enter student name to check if exists: ");
        String checkStudent = scanner.nextLine();
        if (studentMarks.containsKey(checkStudent)) {
            System.out.println(checkStudent + " is present in the LinkedHashMap.");
        } else {
            System.out.println(checkStudent + " is not present in the LinkedHashMap.");
        }

        // Removing an element using a key
        System.out.print("Enter student name to remove: ");
        String removeStudent = scanner.nextLine();
        studentMarks.remove(removeStudent);
        System.out.println("LinkedHashMap after removing " + removeStudent + ": " + studentMarks);

        // Iterating through the LinkedHashMap
        System.out.println("Iterating through the LinkedHashMap:");
        for (Map.Entry<String, Integer> entry : studentMarks.entrySet()) {
            System.out.println("Student: " + entry.getKey() + ", Marks: " + entry.getValue());
        }

        // Clearing the LinkedHashMap
        studentMarks.clear();
        System.out.println("LinkedHashMap after clearing: " + studentMarks);

        scanner.close();
    }
}
📤 Output:
Initial LinkedHashMap: {Alice=85, Bob=92, Charlie=78, David=95}
Enter student name to get marks: Alice
Output: Alice's marks: 85
Enter student name to check if exists: Bob
Output: Bob is present in the LinkedHashMap.
Enter student name to remove: Charlie
Output: LinkedHashMap after removing Charlie: {Alice=85, Bob=92, David=95}
Iterating through the LinkedHashMap:
Student: Alice, Marks: 85
Student: Bob, Marks: 92
Student: David, Marks: 95
LinkedHashMap after clearing: {}

💻 HashMap Operations
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class HashMapOperations {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // Creating a HashMap
        Map<String, Integer> studentMarks = new HashMap<>();

        // Adding key-value pairs to the HashMap
        System.out.print("Enter the number of students: ");
        int numberOfStudents = scanner.nextInt();
        scanner.nextLine(); // Consume the newline character

        for (int i = 0; i < numberOfStudents; i++) {
            System.out.print("Enter student name: ");
            String studentName = scanner.nextLine();
            System.out.print("Enter marks for " + studentName + ": ");
            int marks = scanner.nextInt();
            scanner.nextLine(); // Consume the newline character

            studentMarks.put(studentName, marks);
        }

        // Printing the HashMap
        System.out.println("Student Marks: " + studentMarks);

        // Getting a value from the HashMap
        System.out.print("Enter a student name to retrieve marks: ");
        String searchName = scanner.nextLine();
        Integer retrievedMarks = studentMarks.get(searchName);

        if (retrievedMarks != null) {
            System.out.println(searchName + "'s marks: " + retrievedMarks);
        } else {
            System.out.println("Student " + searchName + " not found.");
        }

        // Checking if a key exists
        System.out.print("Enter a student name to check if it exists: ");
        String checkName = scanner.nextLine();
        if (studentMarks.containsKey(checkName)) {
            System.out.println("Student " + checkName + " exists in the HashMap.");
        } else {
            System.out.println("Student " + checkName + " does not exist in the HashMap.");
        }

        // Removing a key-value pair
        System.out.print("Enter a student name to remove: ");
        String removeName = scanner.nextLine();
        studentMarks.remove(removeName);
        System.out.println("HashMap after removing " + removeName + ": " + studentMarks);

        // Checking size of the HashMap
        System.out.println("Size of the HashMap: " + studentMarks.size());

        // Clearing the HashMap
        studentMarks.clear();
        System.out.println("HashMap after clearing: " + studentMarks);

        // Closing the scanner
        scanner.close();
    }
}
📤 Output:
Input: 2
Output: Enter the number of students: Enter student name: Alice
Input: 90
Output: Enter marks for Alice: Enter student name: Bob
Input: 85
Output: Enter marks for Bob: Student Marks: {Bob=85, Alice=90}
Input: Alice
Output: Enter a student name to retrieve marks: Alice's marks: 90
Input: Charlie
Output: Enter a student name to check if it exists: Student Charlie does not exist in the HashMap.
Input: Bob
Output: Enter a student name to remove: HashMap after removing Bob: {Alice=90}
Output: Size of the HashMap: 1
Output: HashMap after clearing: {}

Collections Framework - Map

💻 Custom Object in Set
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

class Employee {
    private int empId;
    private String empName;

    public Employee(int empId, String empName) {
        this.empId = empId;
        this.empName = empName;
    }

    public int getEmpId() {
        return empId;
    }

    public String getEmpName() {
        return empName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Employee employee = (Employee) o;
        return empId == employee.empId; // comparing based on empId
    }

    @Override
    public int hashCode() {
        return Objects.hash(empId); // hash code based on empId
    }

    @Override
    public String toString() {
        return "Employee{" +
                "empId=" + empId +
                ", empName='" + empName + ''' +
                '}';
    }
}

public class CustomObjectInSet {
    public static void main(String[] args) {
        Set<Employee> employeeSet = new HashSet<>();

        Employee emp1 = new Employee(101, "Ramesh");
        Employee emp2 = new Employee(102, "Suresh");
        Employee emp3 = new Employee(101, "Ramesh"); // Same empId as emp1

        employeeSet.add(emp1);
        employeeSet.add(emp2);
        employeeSet.add(emp3);

        System.out.println("Employee Set:");
        for (Employee employee : employeeSet) {
            System.out.println(employee);
        }
    }
}
📤 Output:
Employee Set:
Employee{empId=101, empName='Ramesh'}
Employee{empId=102, empName='Suresh'}

💻 Set to Array Conversion
import java.util.HashSet;
import java.util.Set;

public class SetToArrayConversion {

    public static void main(String[] args) {
        Set<String> mySet = new HashSet<>();
        mySet.add("Apple");
        mySet.add("Banana");
        mySet.add("Orange");

        String[] myArray = mySet.toArray(new String[0]);

        System.out.println("Elements in the array:");
        for (String element : myArray) {
            System.out.println(element);
        }
    }
}
📤 Output:
Elements in the array:
Orange
Apple
Banana