Find Jobs
Hire Freelancers

Dafny - Binary min-heap Software Verification

€8-30 EUR

Em Andamento
Publicado há mais de 5 anos

€8-30 EUR

Pago na entrega
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 ().
ID do Projeto: 18231609

Sobre o projeto

2 propostas
Projeto remoto
Ativo há 5 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos
2 freelancers estão ofertando em média €32 EUR for esse trabalho
Avatar do Usuário
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 em 1 dia
4,7 (577 avaliações)
7,6
7,6
Avatar do Usuário
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 em 1 dia
4,9 (134 avaliações)
6,4
6,4

Sobre o cliente

Bandeira do(a) PORTUGAL
Lisboa, Portugal
5,0
1
Método de pagamento verificado
Membro desde jan. 27, 2014

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos Publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.