Video: Puas muaj chaw nyob hauv Java?
2024 Tus sau: Lynn Donovan | [email protected]. Kawg hloov kho: 2023-12-15 23:47
Rau Java 8, hloov kho ntawm cov lus teb uas twb muaj lawm: Koj tuaj yeem siv Java Priority Queue li a Heap.
Ib yam li ntawd, tib neeg nug, dab tsi yog pob zeb hauv Java?
Cov pob yog qhov chaw khiav haujlwm cov ntaub ntawv los ntawm qhov chaw nco rau txhua chav kawm thiab arrays raug faib. Cov pob yog tsim los ntawm lub tshuab virtual pib. Heap cia rau cov khoom yog reclaimed los ntawm ib tug tsis siv neeg cia tswj system (lub npe hu ua ib tug khib nyiab collector); cov khoom yeej tsis tau hais meej meej.
Tom qab, lo lus nug yog, binary tsob ntoo yog heap? A binary pob yog a pob cov ntaub ntawv qauv uas siv daim ntawv ntawm a tsob ntoo binary . Binary heaps yog ib txoj hauv kev los ua cov txheej txheem ua ntej. Heap Cov cuab yeej: tus yuam sij khaws cia nyob rau hauv txhua lub node yog ntau dua lossis sib npaug rau (≧) lossis tsawg dua lossis sib npaug rau (≦) cov yuam sij hauv cov node cov menyuam, raws li qee qhov kev txiav txim tag nrho.
Tom qab, lo lus nug yog, yuav ua li cas heap yog siv nyob rau hauv Java?
Peb siv chav PriorityQueue rau siv Heaps hauv Java . Los ntawm default Min Heap yog siv los ntawm chav kawm no.
Rau ib qho ith node, i.e., Arr:
- Arr[(i -1) / 2] rov qab nws niam txiv node.
- Arr[(2 * i) + 1] rov qab nws tus me nyuam ntawm sab laug.
- Arr[(2 * i) + 2] rov qab nws txoj cai me nyuam node.
Puas yog lub heap?
Cov Heap . Cov pob yog thaj tsam ntawm koj lub khoos phis tawj lub cim xeeb uas tsis tswj hwm rau koj, thiab tsis yog tswj hwm nruj heev los ntawm CPU. Nws yog thaj chaw dawb-floating ntau dua ntawm kev nco (thiab loj dua). Txhawm rau faib lub cim xeeb rau ntawm pob , koj yuav tsum siv malloc() lossis calloc(), uas yog built-in C ua haujlwm.
Pom zoo:
Muaj pes tsawg theem ntawm indirection nyob rau hauv pointers koj muaj peev xwm muaj nyob rau hauv ib qho kev tshaj tawm?
Koj puas tuaj yeem muaj nyob rau hauv ib qho kev tshaj tawm? cov lus teb yog "tsawg kawg 12." txhawb ntxiv. ntawm saj, tab sis muaj qhov txwv. Muaj ob theem ntawm kev taw qhia (tus taw tes rau tus taw tes rau ib yam dab tsi) yog qhov ntau
Vim li cas Classful chaw nyob tsis muaj chaw nyob?
Classless inter-domain routing (CIDR) Cov txheej txheem IP chaw nyob hauv chav kawm, yog li ntawd, ua pov thawj tias khib nyiab vim qhov chaw IP chaw nyob tau muaj neeg coob. CIDR yog ib txoj hauv kev subnetting uas ua rau cov thawj coj tso qhov kev faib tawm ntawm cov khoom siv network thiab tus tswv tsev khoom nyob qhov twg hauv qhov chaw nyob, tsis yog ntawm octets
Ib qho chaw tsis muaj zog puas tuaj yeem muaj qhov chaw tsis muaj zog?
Hom chaw tsis muaj zog muaj qee qhov yuam sij. Nco tseg- Lub koom haum tsis muaj zog ib txwm muaj kev koom tes tag nrho tab sis lub koomhaum muaj zog yuav tsis muaj tag nrho kev koom tes.Weak entity yog nyob ntawm qhov chaw muaj zog kom ntseeg tau tias muaj qhov tsis muaj zog. Zoo li lub koom haum muaj zog, qhov tsis muaj zog tsis muaj qhov tseem ceeb, Nws muaj feem cuam tshuam kev ntxub ntxaug
Qhov chaw nyob ntawm lub cev thiab qhov chaw nyob qhov chaw nyob yog dab tsi?
Qhov sib txawv yooj yim ntawm Logical thiab lub cev chaw nyob yog qhov chaw nyob Logical yog tsim los ntawm CPU hauv kev xav ntawm ib qho kev pab cuam. Ntawm qhov tod tes, qhov chaw nyob ntawm lub cev yog qhov chaw nyob uas muaj nyob hauv lub cim xeeb. Cov txheej txheem ntawm txhua qhov chaw nyob uas tsim los ntawm CPU fora program hu ua Logical Address Space
Muaj pes tsawg cov khoom nyob hauv txhua qhov chaw ntawm IPv6 chaw nyob?
Qhov chaw nyob IPv6 yog 128 me ntsis hauv qhov ntev thiab muaj yim, 16-ntsis teb, nrog rau txhua daim teb bounded los ntawm txoj hnyuv. Txhua daim teb yuav tsum muaj tus lej hexadecimal, sib piv rau dotted-decimal cim ntawm IPv4 chaw nyob. Hauv daim duab tom ntej, tus x yog tus lej hexadecimal