Qiziqishingiz mumkin yuqoridagi kodda sort ishlatilgan va nima uchun bu kod ning time complexity si
NLogN
emas deb, to’g’ri. Sortlash uchun NLogN
. lekin bizdagi array ning hajmi 26 va bu array ni saralash uchun 26*log(26)
. Lekin, buni hisoblab ko’rsak 200 dan ham kam bu esa const time hisoblanadi. Unda nima uchun O(1)
bo’lmadi deb o’ylayotgan bo’lsangiz tepadagi 2 ta so’zlarning uzunligi maximum 10ˆ5
ekanligi berilgan va biz ularni massiv shakliga keltirib to’liq yurib chiqdik bu esa O(N)
. Shunday qilib: O(N) + O(1) = O(N)
.👍4
Har bir thread ning o'zining nomi bor(by default). Biz xohlagan threadimiz uchun o'zimiz xohlagan nomni bera olamizmi?
Anonymous Quiz
64%
ha albatta, myThread.setName(“some name”)
36%
yo’q, har bir thread uchun java o'zi nom qo'yadi, masalan Thread-0, Thread-1 …
👍1
Yuqoridagi methoddan bir vaqtda faqat bir thread foylanishini qanday ta'minlasa bo'ladi?
Anonymous Quiz
36%
void kalit so'zi oldidan synchronized kalit so'zini yozish kerak
40%
method nomi oldidan synchronized kalit so'zini yozish kerak
20%
buni method ni o'zgartirish orqali amalga oshirib bo'lmaydi
4%
buni umuman iloji yo'q
Savol: Deadlock nima?
Javobingizni kommentda qoldiring...
Please open Telegram to view this post
VIEW IN TELEGRAM
Biror maqsadga erishish uchun eng asosiy kerak bo’ladigan narsalar:
1. Intention(niyat)
2. Discipline(intizom)
3. Consistency(doimiylik, uzluksizlik)
Majburiy emas, ammo juda katta yordam beradigani esa bu:
Keling birgalikda 14 kunlik Data-Structure study-plan ni o’zimiz uchun challenge qilamiz va har kuni yechimlar bilan bo’lishamiz. Balkim video ko’rinishidagi yechimlar ham ta’minlanar. Birgalikda har kuni taxminan 2 3 ta masala yechish orqali Data Structure ga oid bilimlarimizni oshirib va yangilab olamiz. Ohirida esa badge ga ham ega bo’lamiz.
Telegram: JavaHereBlogs
Youtube: JavaIsHere
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Study Plan - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
Keling ertaga, dushanbadan, 2023-yildan emas
Bugundan boshlaymiz yani 3-dekabrdan.
Shior: Let you start today!
Bugundan boshlaymiz yani 3-dekabrdan.
Shior: Let you start today!
👍14
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Sort Characters By Frequency - LeetCode
Can you solve this real interview question? Sort Characters By Frequency - Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string.
Return the sorted…
Return the sorted…
⚡1
tg_image_3152687319.jpeg
270.2 KB
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡1
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Contains Duplicate - LeetCode
Can you solve this real interview question? Contains Duplicate - Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
Example 1:
Input: nums = [1,2,3,1]
Output: true…
Example 1:
Input: nums = [1,2,3,1]
Output: true…
⚡1
tg_image_1331039773.jpeg
105 KB
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡1
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Maximum Subarray - LeetCode
Can you solve this real interview question? Maximum Subarray - Given an integer array nums, find the subarray with the largest sum, and return its sum.
Example 1:
Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Explanation: The subarray [4,-1,2,1] has…
Example 1:
Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Explanation: The subarray [4,-1,2,1] has…
⚡1
tg_image_314182173.jpeg
116.6 KB
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡5
Mana Graflar bo’limini ham boshlab oldik Alhamdulillah. Endi graflar haqida kamchiliklarni to’ldirib o’rniga oshig’i bilan bilimlar olishingiz mumkin, buni hali ancha davom ettiraman qo’limdan kegancha.
Telegram: JavaHereBlogs
Youtube: JavaIsHere
Please open Telegram to view this post
VIEW IN TELEGRAM
YouTube
Graphs theory | Graflar nazariyasi
Bu darsda dasturlashdagi graflar mavsuzini o'rganamiz.
O'zbekcha kontentlar ko'payishiga va tarqalishiga hissa qo'shing.
Asosiy qismlari:
00:00 - Kirish
00:44 - Asosiy qism
02:36 - Konigsberg ko'priklari masalasi
03:10 - Unordered Pair
04:14 - Ordered Pair…
O'zbekcha kontentlar ko'payishiga va tarqalishiga hissa qo'shing.
Asosiy qismlari:
00:00 - Kirish
00:44 - Asosiy qism
02:36 - Konigsberg ko'priklari masalasi
03:10 - Unordered Pair
04:14 - Ordered Pair…
🔥7⚡2
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Minimum Average Difference - LeetCode
Can you solve this real interview question? Minimum Average Difference - You are given a 0-indexed integer array nums of length n.
The average difference of the index i is the absolute difference between the average of the first i + 1 elements of nums and…
The average difference of the index i is the absolute difference between the average of the first i + 1 elements of nums and…
⚡1👍1
tg_image_223185789.jpeg
200.6 KB
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡1👍1
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Two Sum - LeetCode
Two Sum - Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return…
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return…
⚡1👍1
tg_image_217301420.jpeg
121.2 KB
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥2👍1