- 0
[c] Heap Question
Asked by
mackol,
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By Nick H. · Posted
I must admit, this is probably the only game at the moment where I can see that $80 price point being ok. The issue will be when other developers think they can get away with it with half of the work. -
By Fiza Ali · Posted
Google Wallet expands TSA PreCheck Touchless ID access to more travellers by Fiza Ali Google has announced that Google Wallet is becoming the first digital wallet to integrate with TSA PreCheck Touchless ID. It is a programme that lets eligible travellers move through participating airport security checkpoints using facial recognition instead of showing a physical ID or boarding pass. While the TSA PreCheck Touchless ID programme has been available for some time, using it hasn't always been straightforward. The programme currently operates at 65 airports across the US, but participation has largely depended on flying with a limited number of airlines. Travellers also had to upload passport information separately through participating carriers. Now, the tech giant's new integration is designed to remove some of those extra steps. With the update rolling out in the coming weeks, travellers with TSA PreCheck membership will be able to enrol in Touchless ID through Google Wallet and use the service with any of the 100 airlines participating in the programme. Rather than repeatedly submitting identification details, users can store a digital ID in Google Wallet and use it to streamline future trips. Setting up the feature is relatively straightforward as well. The process starts with users creating a digital ID in Google Wallet using their passport information. After checking in for a flight and saving a boarding pass to the app, eligible travellers will see a "Get started" option that directs them to the TSA enrolment process. Once users choose to share their ID pass and boarding pass information with the TSA for a specific trip, the agency will verify the enrolment. If approved, a TSA PreCheck Touchless ID indicator will appear on the boarding pass stored in Google Wallet, signalling that the traveller can use designated express Touchless ID lanes at participating airports. As privacy and security are likely to be key considerations for many travellers, Google says users must explicitly opt in before any information is shared with the TSA, and authentication is required through a device PIN, pattern, or biometric verification. The company also notes that digital IDs stored in Google Wallet remain encrypted and are kept on the user's device. For frequent flyers who already use TSA PreCheck, the new integration could remove a few more steps from the airport security process, making travel slightly faster and a little less cumbersome. -
By excalpius · Posted
Even though MS had to sunset the Windows Subsystem for Android, you can apparently use BlueStacks to run Android in Windows now. I haven't tested this yet, so if anyone has any feedback, I'd love to hear it. -
By excalpius · Posted
Or, if you want to teach your kids how to hallucinate and lie like AI slop, introduce them to a Crazy MAGA Grandpa on LSD. -
By Copernic · Posted
Ventoy 1.1.14 by Razvan Serea Ventoy is an open source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files. With Ventoy, you don't need to format the disk over and over, you just need to copy the ISO/WIM/IMG/VHD(x)EFI files to the USB drive and boot them directly. You can copy many files at a time and ventoy will give you a boot menu to select them. Both Legacy BIOS and UEFI are supported in the same way. Most type of OS supported (Windows/WinPE/Linux/Unix/Vmware/Xen...) Ventoy features: 100% open source Simple to use Fast (limited only by the speed of copying iso file) Directly boot from ISO/WIM/IMG/VHD(x)/EFI file, no extraction needed Legacy + UEFI supported in the same way UEFI Secure Boot supported (since 1.0.07+) Persistence supported (since 1.0.11+) MBR and GPT partition style supported (1.0.15+) WIM files boot supported (Legacy + UEFI) (1.0.12+) IMG files boot supported (Legacy + UEFI) (1.0.19+) Auto installation supported (1.0.09+) File injection supported (1.0.16+) ISO files larger than 4GB supported Native boot menu style for Legacy & UEFI Most type of OS supported(Windows/WinPE/Linux/Unix/Vmware/Xen...), 550+ iso files tested Not only boot but also complete installation process ISO files can be listed in List mode/TreeView mode Linux vDisk boot supported (vdi/vhd/raw) "Ventoy Compatible" concept Plugin Framework Menu Alias/Menu Style/Customized Menu supported USB drive write-protected support USB normal use unaffected Data nondestructive during version upgrade No need to update Ventoy when a new distro is released Ventoy 1.1.14 changelog: Update secure boot shim file to solve the UEFI CA 2023 issue. The new release use a new CA, so you need to enroll the new key for the first boot time. VentoyPlugson update synchronously. Global control plugin add a VTOY_SECURE_BOOT_POLICY option. Notes Download: Ventoy 1.1.14 | 15.9 MB (Open Source) Download: Ventoy Live CD | 187.0 MB Link: Ventoy Home Page | Project Page @GitHub | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
-
-
Recent Achievements
-
Scoobystu earned a badge
Dedicated
-
Tom Schmidt earned a badge
First Post
-
D0nn13 earned a badge
One Month Later
-
+ChiefOfNeo went up a rank
Rookie
-
Tom Schmidt earned a badge
One Year In
-
-
Popular Contributors
-
Tell a friend
Question
mackol
i tried really hard to avoid posting this question but i cant seem to spot the problem :(
so here it is..
basically i want to print the highest number of 'search_counts' from a heap.
> there is an array of struct HEAP
> there is only 1 element in HEAP , it is DATA *dataPtr , basically it points to a struct DATA (which has been allocated memory dynamically)
> i have to delete the top most item from the heap ary and print it and then reheapDown to get it back to a heap form.
problem: it prints all but the last element correctly. for the last element it prints out garbage. :(
i have been through the debugger so many times but yet it failed.
here is the code
int j is the count of how many elements were inserted into the heap ary
int whatFn is basically a checker to see that if the number of elements inserted was less than the HEAP_SIZE which is 7 then use j otherwise use HEAP_SIZE for the restrictor
void printHeap1 (HEAP *ary, int j, int whatFn) { int i = 0; HEAP *pWalker, *pCur, *pLast, dataOut; pCur = ary; printf("--- 7 Most popular searches ---\n"); if (whatFn == NOT_EQUAL) { pLast = &ary[j]; j--; for (pWalker = pCur; pWalker < pLast; pWalker++) { if (deleteHeap (ary, &j, &dataOut) == 1) printToScreen (&dataOut, "heap"); else printf("Unable to delete node\n"); } } else { pLast = &ary[HEAP_SIZE -1]; j--; for (pWalker = pCur; pWalker < pLast; pWalker++) { if (deleteHeap (ary, &j, &dataOut) == 1) printToScreen (&dataOut, "heap"); else printf("Unable to delete node\n"); } } return; }this goes to the delete heap function that is
int deleteHeap (HEAP *heap, int *last, HEAP *dataOut) { // int item; if (*last < 0) { return 0; } dataOut->dataPtr = heap[0].dataPtr; heap [0].dataPtr = heap [*last].dataPtr; // heap[*last].dataPtr = NULL; (*last)--; reheapDown (heap, 0, *last); return 1; }this later goes to the reheapDown function which is
void reheapDown (HEAP *heap, int root, int last) { DATA hold, leftKey, rightKey, largeChildKey; int largeChildIndex = 0; //int parent; if ((root * 2 + 1) <= last) { leftKey = *(heap [root * 2 + 1].dataPtr); if ((root * 2 + 2) <= last) { rightKey = *(heap [root * 2 + 2].dataPtr); } else { rightKey.search_count = -1; } if (leftKey.search_count > rightKey.search_count) { largeChildKey = leftKey; largeChildIndex = root * 2 + 1; } else { largeChildKey = rightKey; largeChildIndex = root * 2 + 2; } if (heap[root].dataPtr->search_count < heap [largeChildIndex].dataPtr->search_count) { hold = *(heap [root].dataPtr); heap [root].dataPtr = heap [largeChildIndex].dataPtr; heap [largeChildIndex].dataPtr = &hold; reheapDown (heap, largeChildIndex, last); } } return; }any form of help is appreciated. i just need someone to spot the error. i can fix the rest myself
thanks :)
Link to comment
https://www.neowin.net/forum/topic/52712-c-heap-question/Share on other sites
7 answers to this question
Recommended Posts