Find Jobs
Hire Freelancers

Dafny - Binary min-heap Software Verification

€8-30 EUR

W trakcie realizacji
Opublikowano ponad 5 lat temu

€8-30 EUR

Płatne przy odbiorze
A binary min-heap without duplicated elements is a binary tree which satisfies two properties: 1. the value of each node is (strictly) greater then the value of its parent, with the minimum-value element at the root (this is the min-heap property), and 2. is complete. Binary heaps have efficient implementations on arrays. There are logarithmic algorithms to insert an element in a heap and to remove the minimum element from an heap. We concentrate on the former. Consider the below class featuring a partial implementation of a binary min-heap. The root is the second item in the array. We skip the index zero cell of the array for the convenience of implementation.1 class Heap { var s ize : nat ; var heap: array <int >; method i n s e r t ( x: i nt ) requires minHeap ( ) ensures minHeap ( ) { / / I n s e r t the new item at the end of the array var pos := s ize + 1; / / Perco late up while pos > 1 && x < heap [ pos / 2 ] { heap [ pos ] := heap [ pos / 2 ] ; pos := pos / 2 ; heap [ pos ] := x ; } } Write predicate minHeap() and add the necessary contract and annotations to method insert () so that Dafny accepts the code. In method insert, assume that there is enough room in the heap array to contain the new element. Suggestion: proceed in two steps. 1. Start with the quasi binary heap property. 2. Once this is working proceed to show that the complete binary tree property is preserved by method insert ().
Identyfikator projektu: 18231609

Informację o projekcie

2 ofert
Zdalny projekt
Aktywny 5 lat temu

Szukasz sposobu na zarobienie pieniędzy?

Korzyści ze składania ofert na Freelancer.com

Ustal budżet i ramy czasowe
Otrzymuj wynagrodzenie za swoją pracę
Przedstaw swoją propozycję
Rejestracja i składanie ofert jest bezpłatne
2 freelancerzy składają oferty o średniej wysokości €32 EUR dla tej pracy
Awatar Użytkownika
Hello I am C++, Java and algorithm expert and interested in this project. I have reviewed details and confident to handle the project perfectly. I will keep codes simple and well documented. I can start now. Please share more details so we can discuss further. Regards, anshu
€30 EUR w 1 dzień
4,7 (577 opinii)
7,6
7,6
Awatar Użytkownika
Hello, I have a lot of experience in C/C++ and Operating System, Algorithm and Data Structure. I am ready to discuss with you Thank you.
€34 EUR w 1 dzień
4,9 (134 opinii)
6,4
6,4

O kliencie

Flaga PORTUGAL
Lisboa, Portugal
5,0
1
Zweryfikowana metoda płatności
Członek od sty 27, 2014

Weryfikacja Klienta

Dziękujemy! Przesłaliśmy Ci e-mailem link do odebrania darmowego bonusu.
Coś poszło nie tak podczas wysyłania wiadomości e-mail. Proszę spróbować ponownie.
Zarejestrowani Użytkownicy Całkowita Liczba Opublikowanych Projektów
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Wczytywanie podglądu
Udzielono pozwolenia na Geolokalizację.
Twoja sesja logowania wygasła i zostałeś wylogowany. Proszę, zalogować się ponownie.