Laborator 4. Rezolvări

Size: px
Start display at page:

Download "Laborator 4. Rezolvări"

Transcription

1 Programare Delphi Exerciţiul 1. Quicksort cu pivotul pe stânga program Rezoli_1; {$APPTYPE CONSOLE} n = 13; Laborator 4. Rezolvări a: vector = (1, 51, 2, 4, 9, 100, 15, 6, 0, 8, 19, 10, 11); procedure schimba( x, y: integer); aux: integer; aux := x; x := y; y := aux; // initial pivotul=stg si iproviz=drp // impartim si rearanjam subtabloul [stg..drp] in // [stg..][iproviz..drp] // astfel incat // elementele din [stg..] sa fie < valoarea pivotului // elementele din [iproviz..drp] sa fie >= valoarea pivotului // la final mutam pivotul pe locul provizoriu procedure combina(stg, mij, drp: integer); procedure rezolvadirect(stg, drp: integer); valpivot, iproviz, valpivot := a[stg]; // pivotul este initial in stg iproviz := drp; for i := drp downto stg+1 do if a[i] >= valpivot then // mutam a[i] in dreapta schimba(a[i], a[iproviz]); iproviz := iproviz - 1 schimba(a[iproviz], a[stg]); // mutam pivotul pe locul final exit(iproviz); 1

2 procedure rezolva(stg, drp: integer); med: integer; if drp <= stg then rezolvadirect(stg, drp) med := divide(stg, drp); rezolva(stg, med - 1); rezolva(med + 1, drp); combina(stg, med, drp); rezolva(1, n); for i := 1 to n do write(a[i]:4); Writeln; 2

3 Exerciţiul 2. Sortare prin interclasare program MergeSort; {$APPTYPE CONSOLE} // sortare cu interclasare n = 14; a: vector = (10, 11, 5, 70, 31, 40, -4, 5, 6, 0, 8, 9, 10, 11); reg: vector; procedure combina(stg, mij, drp: integer); i, istg, idrp: integer; // if(tab[mij]<=tab[mij+1]) then Exit; i := stg; istg := stg; idrp := mij + 1; while (istg <= mij) and (idrp <= drp) do if a[istg] <= a[idrp] then reg[i] := a[istg]; Inc(istg); end reg[i] := a[idrp]; Inc(idrp); while (istg <= mij) do // daca au mai ramas in stg reg[i] := a[istg]; Inc(istg); while (idrp <= drp) do // daca au mai ramas in drp reg[i] := a[idrp]; Inc(idrp); for i := stg to drp do a[i] := reg[i]; 3

4 procedure rezolvadirect(stg, drp: integer); aux: integer; if a[stg] > a[drp] then aux := a[stg]; a[stg] := a[drp]; a[drp] := aux; result:=(stg+drp) div 2; procedure rezolva(stg, drp: integer); med: integer; if drp <= stg + 1 then rezolvadirect(stg, drp) med := divide(stg,drp); rezolva(stg, med); rezolva(med + 1, drp); combina(stg, med, drp); rezolva(1, n); for i := 1 to n do write(a[i]:4); Writeln; 4

5 Exerciţiul 3. Calculul sumelor program Rezoli_3; {$APPTYPE CONSOLE} //suma prin divide et impera n = 11; a: vector = (100, 200, 35, 40, 555, 61, 77, 81, 200, 340, 111); function combina(solstg, soldrp: integer): integer; result := solstg + soldrp; function rezolvadirect(stg, drp: integer): integer; result := a[stg]; result := (stg + drp) div 2; function rezolva(stg, drp: integer): integer; med, sumstg, sumdrp: integer; if stg = drp then result := rezolvadirect(stg, drp) med := divide(stg, drp); sumstg := rezolva(stg, med); sumdrp := rezolva(med + 1, drp); result := combina(sumstg, sumdrp); min: integer; Writeln(rezolva(1, n)); 5

6 Exerciţiul 5. Evaluarea polinoamelor. program EvalPolinoame; {$APPTYPE CONSOLE} // Evaluarea polinoamelor n = 5; a: vector = (1, -2, 3, 5, 3); function putere(m: integer; x: double): double; result := 1; for i := 1 to m do result := result * x; function combina(m: integer; solstg, soldrp, x: double): double; result := solstg + putere(m, x) * soldrp; function rezolvadirect(stg, drp: integer; x: double): double; result := a[stg]; result := (stg + drp) div 2; function rezolva(stg, drp: integer; x: double): double; med: integer; solstg, soldrp: double; if drp = stg then result := rezolvadirect(stg, drp, x) med := divide(stg, drp); solstg := rezolva(stg, med, x); soldrp := rezolva(med + 1, drp, x); result := combina(med - stg + 1, solstg, soldrp, x); 6

7 function Horner(stg, drp: integer; x: double): double; result := 0; for i := drp downto stg do result := a[i] + x * result; x: double; x := 1.2; Writeln(rezolva(1, n, x):0:6); Writeln(Horner(1, n, x):0:6); 7

Rezolvare fişă de laborator Java Iniţiere în limbajul Java

Rezolvare fişă de laborator Java Iniţiere în limbajul Java Rezolvare fişă de laborator Java Iniţiere în limbajul Java Ex 1: Scrie următorul program Java folosind JCreator apoi încercă să-l înţelegi. public class primulprg System.out.println("Acesta este primul

More information

Laborator 3 Java. Introducere in programarea vizuala

Laborator 3 Java. Introducere in programarea vizuala Laborator 3 Java Introducere in programarea vizuala 1. Pachetele AWT si Swing. 2. Ferestre 3.1. Introduceti urmatorul program JAVA: public class Pv public static void main(string args[ ]) JFrame fer=new

More information

Se cer 2 variante: una cu implementarea statica si a doua cu implementarea dinamica a structurilor de date necesare. Comentati variantele.

Se cer 2 variante: una cu implementarea statica si a doua cu implementarea dinamica a structurilor de date necesare. Comentati variantele. Lucrarea 1 SDA 03.04.2017 Sa se realizeze urmatoarele programe, in limbaj C: 1. Se primesc de la intrarea standard: un numar k si un sir infinit de numere naturale a i. Se afiseaza la iesirea standard,

More information

GHID DE UTILIZARE A APLICAȚIEI MINISTRA PLAY PE SMART TV

GHID DE UTILIZARE A APLICAȚIEI MINISTRA PLAY PE SMART TV GHID DE UTILIZARE A APLICAȚIEI MINISTRA PLAY PE SMART TV TV Deschide aplicația Ministra Play din bara de jos a interfeței TV. Selectează aplicația Ministra Play utilizând cursorul telecomenzii. Apar 4

More information

1. Să se determine de câte ori apare cifra c în scrierea în baza p a numărului n.

1. Să se determine de câte ori apare cifra c în scrierea în baza p a numărului n. Observatii: Codul de mai jos a fost realizat si testat pe pagina online: https://www.tutorialspoint.com/compile_pascal_online.php 1. Să se determine de câte ori apare cifra c în scrierea în baza p a numărului

More information

Laborator 5 Sisteme Lindenmayer. Temă

Laborator 5 Sisteme Lindenmayer. Temă Laborator 5 Sisteme Lindenmayer. Temă 1. Parcurgerea unui pătrat. Următorul L-sistem Alfabet=F,+,-; Producţii= F -> F-F+F+F+F-F-F-F+F, + -> +, - -> - Axioma= F generează, cu interpretările standard (F

More information

Probleme propuse pentru Testul de Laborator Semestrul I

Probleme propuse pentru Testul de Laborator Semestrul I Probleme propuse pentru Testul de Laborator Semestrul I Problema 1: Scrieti un program in C pentru rezolvarea ecuatiei de gradul 1 cu coeficienti reali. Valorile coeficientilor se citesc de la tastatura.

More information

[LABORATOR DE PROGRAMARE C++] Aritoni Ovidiu. Algoritmi STL

[LABORATOR DE PROGRAMARE C++] Aritoni Ovidiu. Algoritmi STL Algoritmi STL 1. Prezentare generală 2. Clasificare: Algoritmi nechirurgicali ; Algoritmi chirurgicali ; Algoritmi de sortare; Algoritmi generali; 3. Algoritmi nechirurgicali (Non-mutating algorithms)

More information

Laborator 5 Instrucțiunile repetitive

Laborator 5 Instrucțiunile repetitive Laborator 5 Instrucțiunile repetitive Instrucțiunea for Instrucțiunea for permite repetarea unei secvențe de instrucțiuni atâta timp cât o condiție este îndeplinita. În plus, oferă posibilitatea execuției

More information

Chapter 7 Arrays. One-Dimensional Arrays. Fred Jack. Anna. Sue. Roy

Chapter 7 Arrays. One-Dimensional Arrays. Fred Jack. Anna. Sue. Roy Chapter 7 Arrays High-level languages provide programmers with a variety of ways of organising data. There are not only simple data types, but also data structures. A data structure is a data type composed

More information

Probleme consultații 20 ianuarie 2018

Probleme consultații 20 ianuarie 2018 Algoritmi elementari Probleme consultații 20 ianuarie 2018 Problema 1: zerouri factorial Enunt Fiind dat un numar natural n, sa se determine numarul de cifre 0 cu care se termină factorialul numărului

More information

Fisiere text in Java.

Fisiere text in Java. Fisiere text in Java. Doru Anastasiu Popescu Prelucrarea fisierelor text in Java Aspecte teoretice: http://cursuri.cs.pub.ro/~poo/wiki/index.php/input/output http://upm.ro/intranet/ecalin/cd_educational/cd/javac/cap3.htm

More information

Utilizarea formularelor in HTML

Utilizarea formularelor in HTML Utilizarea formularelor in HTML Formulare Un formular este constituit din elemente speciale, denumite elemente de control (controls), cum ar fi butoane radio, butoane de validare, câmpuri text, butoane

More information

PNI SmartCAM. versiune Android. - manual de utilizare-

PNI SmartCAM. versiune Android. - manual de utilizare- PNI SmartCAM versiune Android - manual de utilizare- Introducere: Acest manual se refera la instalarea si utilizarea aplicatiei PNI SmartCAM, software necesar monitorizarii atat camerei cu IP PNI 631W,

More information

Lucrarea de laborator nr. 5

Lucrarea de laborator nr. 5 Mete Numerice Lucrarea de laborator nr. 5 I. Scopul lucrării Aplicaţii ale eliminării gaussiene cu pivotare parţială: - calculul determinantului unei matrice - rezolvarea sistemelor liniare - calculul

More information

Sorting Algorithms. For special input, O(n) sorting is possible. Between O(n 2 ) and O(nlogn) E.g., input integer between O(n) and O(n)

Sorting Algorithms. For special input, O(n) sorting is possible. Between O(n 2 ) and O(nlogn) E.g., input integer between O(n) and O(n) Sorting Sorting Algorithms Between O(n ) and O(nlogn) For special input, O(n) sorting is possible E.g., input integer between O(n) and O(n) Selection Sort For each loop Find max Swap max and rightmost

More information

Probleme la metoda Divide et Impera

Probleme la metoda Divide et Impera Probleme la metoda Divide et Impera 1. a) Calculaţi suma numerelor de la 1 la n, cu metoda D&I. b) Calculaţi produsul numerelor de la 1 la n, cu metoda D&I. c) Calculaţi suma numerelor dintre a şi b, cu

More information

1.Pentru definiţia de mai jos a subprogramului f, ce se afişează ca urmare apeluluif(121,1)? void f(long n, int i) { if(n!=0) if(n%3>0) { cout<<i;

1.Pentru definiţia de mai jos a subprogramului f, ce se afişează ca urmare apeluluif(121,1)? void f(long n, int i) { if(n!=0) if(n%3>0) { cout<<i; 1.Pentru definiţia de mai jos a subprogramului f, ce se afişează ca urmare apeluluif(121,1)? void f(long n, int i) { if(n!=0) if(n%3>0) { cout

More information

Problem. Input: An array A = (A[1],..., A[n]) with length n. Output: a permutation A of A, that is sorted: A [i] A [j] for all. 1 i j n.

Problem. Input: An array A = (A[1],..., A[n]) with length n. Output: a permutation A of A, that is sorted: A [i] A [j] for all. 1 i j n. Problem 5. Sorting Simple Sorting, Quicksort, Mergesort Input: An array A = (A[1],..., A[n]) with length n. Output: a permutation A of A, that is sorted: A [i] A [j] for all 1 i j n. 98 99 Selection Sort

More information

Laborator 8 Java Crearea claselor de obiecte. Variabilele (campurile) clasei de obiecte

Laborator 8 Java Crearea claselor de obiecte. Variabilele (campurile) clasei de obiecte Laborator 8 Java Crearea claselor de obiecte. Variabilele (campurile) clasei de obiecte Probleme rezolvate: Scrieti, compilati si rulati toate exemplele din acest laborator: 1. Programul urmator (LotoConstante.java)

More information

Fişiere in C++ Un fişier este o colecţie de date indicat printr-un nume şi o extensie. Numele este desparţit de extensie prin punct.

Fişiere in C++ Un fişier este o colecţie de date indicat printr-un nume şi o extensie. Numele este desparţit de extensie prin punct. Fişiere in C++ Un fişier este o colecţie de date indicat printr-un nume şi o extensie. Numele este desparţit de extensie prin punct. Avantajul lucrului cu fisiere este evident, datele rezultate în urma

More information

Laborator 9. Programare orientată pe obiecte Laborator 9. 1) Să se realizeze o aplicaţie care să rezolve ecuaţii de gradul al doilea.

Laborator 9. Programare orientată pe obiecte Laborator 9. 1) Să se realizeze o aplicaţie care să rezolve ecuaţii de gradul al doilea. Laborator 9 1) Să se realizeze o aplicaţie care să rezolve ecuaţii de gradul al doilea. Interfaţa aplicaţiei va fi următoarea Casetelor text li se vor da denumirile: camp_a, camp_b, camp_c, rez. Evenimentului

More information

GCE AS and A Level. Computing. AS exams 2009 onwards A2 exams 2010 onwards. Unit 1: Approved specimen question paper. Version 1.1

GCE AS and A Level. Computing. AS exams 2009 onwards A2 exams 2010 onwards. Unit 1: Approved specimen question paper. Version 1.1 GCE AS and A Level Computing AS exams 2009 onwards A2 exams 2010 onwards Unit 1: Approved specimen question paper Version 1.1 Version 1.1 General Certificate of Education Advanced Subsidiary Specimen Paper

More information

Error! Bookmark not defined.

Error! Bookmark not defined. SEMINAR 06 CONTENTS Enuntul Problemei... 1 Repository... 2 Memory... 2 XML... 3 GUI... 4 Forma Selectie... 4 Forma Programator... 5 Forma Tester... 6 Java... 7 Mecanismul de Transmitere al Evenimentelor

More information

Alocarea memoriei în C sub Linux

Alocarea memoriei în C sub Linux Costel Aldea Alocarea memoriei în C sub Linux Sunt trei funcţii C standard care se pot folosi pentru a aloca memorie: malloc(), calloc(), si realloc(). Prototipurile lor, după cum sunt definite în stdlib.h:

More information

Ingineria Sistemelor de Programare. UML Diagrama Cazurilor de Utilizare 2016

Ingineria Sistemelor de Programare. UML Diagrama Cazurilor de Utilizare 2016 Ingineria Sistemelor de Programare UML Diagrama Cazurilor de Utilizare mihai.hulea@aut.utcluj.ro 2016 Introducere UML UML UML = Unified Modeling Language Dezvoltat in cadrul Object Management Group In

More information

Laborator 10. SGBD-ul MySQL (partea I)

Laborator 10. SGBD-ul MySQL (partea I) Laborator 10 SGBD-ul MySQL (partea I) 1. Introduceţi următoarea secvenţă PHP: $dbh = mysql_connect("localhost", "Costica", "mypass") or die("unable to connect to MySQL"); $selectdb = mysql_select_db('lucrudb');

More information

la Microsoft Office Communicator pentru ca modificarea selecţiei dispozitivului telefonic să se actualizeze.

la Microsoft Office Communicator pentru ca modificarea selecţiei dispozitivului telefonic să se actualizeze. QUICK START GUIDE Plug-in de selec ie a telefonului pentru caracteristica de control al apelurilor din Microsoft Office Communicator pentru Cisco Unified Presence versiunea 7.0(3) Prezentare generală 2

More information

CSC 1700 Analysis of Algorithms: Heaps

CSC 1700 Analysis of Algorithms: Heaps CSC 1700 Analysis of Algorithms: Heaps Professor Henry Carter Fall 2016 Recap Transform-and-conquer preprocesses a problem to make it simpler/more familiar Three types: Instance simplification Representation

More information

Curs practic de Java

Curs practic de Java Curs practic de Java Curs - Cristian Frăsinaru acf@infoiasi.ro Facultatea de Informatică Universitatea Al. I. Cuza Iaşi Internaţionalizarea Curs practic de Java p.1/1 Cuprins Introducere Clasa Locale Formatarea

More information

Manual utilizare PNI SmartCAM (Versiune ios)

Manual utilizare PNI SmartCAM (Versiune ios) 1 Manual utilizare PNI SmartCAM (Versiune ios) 2 1. Descriere software PNI SmartCAM (versiune ios) este un instrument pentru administrarea camerelor prin retea, ce pot fi adaugate manual sau prin cautare

More information

Visualizer with Pixel Editor (PE) and Sequence Editor (SE)

Visualizer with Pixel Editor (PE) and Sequence Editor (SE) Using Visualizer with Pixel Editor (PE) and Sequence Editor (SE) This paper demonstrates how to use the Visualizer with PE and SE. This technique will only work if you have Light-O-Rama Sequencing Suite

More information

In Delphi script, when values are assigned to variables, the colon-equal operator is used; :=

In Delphi script, when values are assigned to variables, the colon-equal operator is used; := Statements and Operators Old Content - visit altium.com/documentation Modified by on 13-Sep-2017 Parent page: DelphiScript DelphiScript Statements A statement in DelphiScript is considered as simple when

More information

Programarea calculatoarelor

Programarea calculatoarelor Programarea calculatoarelor #3 C++ Elemente introductive ale limbajului C++ 2016 Adrian Runceanu www.runceanu.ro/adrian Curs 3 Elemente introductive ale limbajului C++ 02.11.2016 Curs - Programarea calculatoarelor

More information

Math & CompSci Contest - model Written Test in Computer Science

Math & CompSci Contest - model Written Test in Computer Science BABEŞ-BOLYAI UNIVERSITY FACULTY OF MATHEMATICS AND COMPUTER SCIENCE Important observations for candidates: Math & CompSci Contest - model Written Test in Computer Science 1. All arrays are indexed starting

More information

DATA STRUCTURES AND ALGORITHMS

DATA STRUCTURES AND ALGORITHMS DATA STRUCTURES AND ALGORITHMS Fast sorting algorithms Heapsort, Radixsort Summary of the previous lecture Fast sorting algorithms Shellsort Mergesort Quicksort Why these algorithm is called FAST? What

More information

Divide-and-Conquer CSE 680

Divide-and-Conquer CSE 680 Divide-and-Conquer CSE 680 1 Introduction Given an instance x of a problem, the divide-and-conquer method works as follows. function DAQ(x) if x is sufficiently small or simple then solve it directly else

More information

DelphiScript Keywords

DelphiScript Keywords DelphiScript Keywords Old Content - visit altium.com/documentation Modified by on 13-Sep-2017 This reference covers the DelphiScript keywords used for the Scripting System in Altium Designer. The scripting

More information

Arbori. 5 aprilie Utilizarea şi programarea calculatoarelor. Curs 16

Arbori. 5 aprilie Utilizarea şi programarea calculatoarelor. Curs 16 Arbori 5 aprilie 2004 Arbori 2 Noţiunea de arbore. Terminologie Arborii ne permit sǎ structurǎm ierarhic o mulţime de elemente structura de directoare şi fişiere într-un calculator arborele genealogic

More information

ACTA TECHNICA NAPOCENSIS

ACTA TECHNICA NAPOCENSIS TECHNICAL UNIVERSITY OF CLUJ-NAPOCA ACTA TECHNICA NAPOCENSIS Series: Applied Mathematics and Mechanics 53, Vol. III, 2010 Programming AutoCAD using Jawin from Java in JDeveloper ANTAL Tiberiu Alexandru

More information

CSC 8301 Design and Analysis of Algorithms: Heaps

CSC 8301 Design and Analysis of Algorithms: Heaps CSC 8301 Design and Analysis of Algorithms: Heaps Professor Henry Carter Fall 2016 Recap Transform-and-conquer preprocesses a problem to make it simpler/more familiar Three types: Instance simplification

More information

Divide and Conquer. Algorithm Fall Semester

Divide and Conquer. Algorithm Fall Semester Divide and Conquer Algorithm 2014 Fall Semester Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances

More information

Vodafone M-Pesa Impact of mobile money on Romanian society

Vodafone M-Pesa Impact of mobile money on Romanian society Vodafone M-Pesa Impact of mobile money on Romanian society Mar 2015 Dana Popescu General Manager M-Pesa Serviciul M-Pesa este furnizat de Vodafone România M-Payments S.R.L. autorizata de către Banca Naţională

More information

Curs 5. Programare Paralela si Distribuita. Forme de sincronizare - Java. Curs 5 - PPD 1

Curs 5. Programare Paralela si Distribuita. Forme de sincronizare - Java. Curs 5 - PPD 1 Curs 5 Programare Paralela si Distribuita Forme de sincronizare - Java Curs 5 - PPD 1 Monitor in Java Fiecare obiect din Java are un mutex care poate fi blocat sau deblocat in blocurile sincronizate: Bloc

More information

CONFIGURAREA UNUI SERVER IRC IN LINUX. Bica Bogdan *

CONFIGURAREA UNUI SERVER IRC IN LINUX. Bica Bogdan * CONFIGURAREA UNUI SERVER IRC IN LINUX Bica Bogdan * In this exemple i show how to configure an irc server based on ircd dameon named ircu.this is the main file name ircd.conf and the most important.configure

More information

Sorting (Weiss chapter )

Sorting (Weiss chapter ) Sorting (Weiss chapter 8.1 8.3) Sorting 5 3 9 2 8 7 3 2 1 4 1 2 2 3 3 4 5 7 8 9 Zillions of sorting algorithms (bubblesort, insertion sort, selection sort, quicksort, heapsort, mergesort, shell sort, counting

More information

void set_target(unsigned char servo, unsigned int pozitie) { //merge la pozitia respectiva

void set_target(unsigned char servo, unsigned int pozitie) { //merge la pozitia respectiva a. Arduino #include Servo servo3; int servopin = 11; int senzor = 0; int val_senzor = 0; int LED = 8; int aux = 100; //librarie pentru servomotoare //declarare variabile void set_target(unsigned

More information

HUMAN COMPUTER INTERFACE

HUMAN COMPUTER INTERFACE HUMAN COMPUTER INTERFACE Human Computer Interface The Changing Face of Communication Until the recent process of computerisation began, the mode of communication had always been a human to human interface.

More information

Sorting (I) Hwansoo Han

Sorting (I) Hwansoo Han Sorting (I) Hwansoo Han Sorting Algorithms Sorting for a short list Simple sort algorithms: O(n ) time Bubble sort, insertion sort, selection sort Popular sorting algorithm Quicksort: O(nlogn) time on

More information

Binary Heaps in Dynamic Arrays

Binary Heaps in Dynamic Arrays Yufei Tao ITEE University of Queensland We have already learned that the binary heap serves as an efficient implementation of a priority queue. Our previous discussion was based on pointers (for getting

More information

CSE 160 Lecture 10. Instruction level parallelism (ILP) Vectorization

CSE 160 Lecture 10. Instruction level parallelism (ILP) Vectorization CSE 160 Lecture 10 Instruction level parallelism (ILP) Vectorization Announcements Quiz on Friday Signup for Friday labs sessions in APM 2013 Scott B. Baden / CSE 160 / Winter 2013 2 Particle simulation

More information

RSA SIGNATURE: BEHIND THE SCENES

RSA SIGNATURE: BEHIND THE SCENES RSA SIGNATURE: BEHIND THE SCENES Dragan Vidakovic 1, Dusko Parezanovic 1, Olivera Nikolic 2 and Jelena Kaljevic 2 1 Gimnazija Ivanjica, Serbia 2 Faculty of Business Valjevo, Singidunum University Belgrade,

More information

TSIF: Transition System Interchange Format

TSIF: Transition System Interchange Format TSIF: Transition System Interchange Format E. Pastor and M.A. Peña Jan 2004 Department of Computer Architecture Technical University of Catalonia (UPC) Barcelona, Spain Modeling Transition System A model

More information

Sisteme de operare 1. Sisteme de operare. Roluri și descriere generală

Sisteme de operare 1. Sisteme de operare. Roluri și descriere generală Platformăde e-learning și curriculăe-content pentru Sisteme de operare 1. Sisteme de operare. Roluri și descriere generală De ce SO? sunt peste tot (PC, servere, smartphones) administrarea eficientă a

More information

Heaps and Priority Queues

Heaps and Priority Queues Unit 9, Part Heaps and Priority Queues Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Priority Queue A priority queue (PQ) is a collection in which each item has an associated number

More information

Algorithms. MIS, KUAS, 2007 Ding

Algorithms. MIS, KUAS, 2007 Ding Algorithms MIS, KUAS, 2007 Jen-Wen Ding 1 2 2 What is Divide-and-Conquer? Divide-and-Conquer divides an instance of a problem into two or more smaller instances. The smaller instances are usually instances

More information

Oferta speciala Vodafone

Oferta speciala Vodafone Oferta speciala Vodafone PERSOANA DE CONTACT S.N.A.P. MATEI MARIN 0722.615.321 Intre orele 08.30 15.00 Abonamente voce cu terminale in rate: 2 Red Connect Eco 7.5 Minute nelimitate in orice retea nationala

More information

Sorting atomic items. Chapter 5

Sorting atomic items. Chapter 5 Sorting atomic items Chapter 5 Sorting on 2-level memory model Atomic items occupy constant-fixed number of memory cells (no variable length). Usually 4 or 8 bytes. Sequence S of n atomic items with n>m

More information

SECTION 5 L1 - Group By and Having Clauses

SECTION 5 L1 - Group By and Having Clauses SECTION 5 L1 - Group By and Having Clauses Clauza Group By 1. SELECT department_id, AVG(salary),MAX(salary) 2. SELECT job_id, last_name, AVG(salary) GROUP BY job_id; ORA-00979: not a GROUP BY expression

More information

Searching, Sorting. part 1

Searching, Sorting. part 1 Searching, Sorting part 1 Week 3 Objectives Searching: binary search Comparison-based search: running time bound Sorting: bubble, selection, insertion, merge Sorting: Heapsort Comparison-based sorting

More information

COS 226 Algorithms and Data Structures Fall Midterm Solutions

COS 226 Algorithms and Data Structures Fall Midterm Solutions 1 COS 226 Algorithms and Data Structures Fall 2010 Midterm Solutions 1. Analysis of algorithms. (a) For each expression in the left column, give the best matching description from the right column. B.

More information

Comparison Sorts. Chapter 9.4, 12.1, 12.2

Comparison Sorts. Chapter 9.4, 12.1, 12.2 Comparison Sorts Chapter 9.4, 12.1, 12.2 Sorting We have seen the advantage of sorted data representations for a number of applications Sparse vectors Maps Dictionaries Here we consider the problem of

More information

Quicksort. Repeat the process recursively for the left- and rightsub-blocks.

Quicksort. Repeat the process recursively for the left- and rightsub-blocks. Quicksort As the name implies, this is the fastest known sorting algorithm in practice. It is excellent for average input but bad for the worst-case input. (you will see later). Basic idea: (another divide-and-conquer

More information

Administrivia. HW on recursive lists due on Wednesday. Reading for Wednesday: Chapter 9 thru Quicksort (pp )

Administrivia. HW on recursive lists due on Wednesday. Reading for Wednesday: Chapter 9 thru Quicksort (pp ) Sorting 4/23/18 Administrivia HW on recursive lists due on Wednesday Reading for Wednesday: Chapter 9 thru Quicksort (pp. 271-284) A common problem: Sorting Have collection of objects (numbers, strings,

More information

The Real Time Implementation of an Efficient Algorithm for Removal Impulse Noise Using Blackfin Microcontroller

The Real Time Implementation of an Efficient Algorithm for Removal Impulse Noise Using Blackfin Microcontroller The Real Time Implementation of an Efficient Algorithm for Removal Impulse Noise Using Blackfin Microcontroller The Real Time Implementation of an Efficient Algorithm for Removal Impulse Noise Using Blackfin

More information

CPS 616 TRANSFORM-AND-CONQUER 7-1

CPS 616 TRANSFORM-AND-CONQUER 7-1 CPS 616 TRANSFORM-AND-CONQUER 7-1 TRANSFORM AND CONQUER Group of techniques to solve a problem by first transforming the problem into one of: 1. a simpler/more convenient instance of the same problem (instance

More information

{ -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '84 } { -- PASCAL PROGRAM SOLUTIONS }

{ -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '84 } { -- PASCAL PROGRAM SOLUTIONS } { -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '84 } { -- PASCAL PROGRAM SOLUTIONS } {1.1} program One1T84; { -- This program produces a table of Fahrenheit for Celcius. } C: Integer; Writeln ('CELCIUS

More information

Ingineria Sistemelor de Programare

Ingineria Sistemelor de Programare Ingineria Sistemelor de Programare Interfete grafice (Swing) mihai.hulea@aut.utcluj.ro 2017 Scurt istoric AWT: Abstract Windowing Toolkit import java.awt.* Swing Java FX Swing Demo Libraria Swing Swing

More information

Annex A (Informative) Collected syntax The nonterminal symbols pointer-type, program, signed-number, simple-type, special-symbol, and structured-type

Annex A (Informative) Collected syntax The nonterminal symbols pointer-type, program, signed-number, simple-type, special-symbol, and structured-type Pascal ISO 7185:1990 This online copy of the unextended Pascal standard is provided only as an aid to standardization. In the case of dierences between this online version and the printed version, the

More information

Heapsort. Heap data structure

Heapsort. Heap data structure Heapsort Heap data structure. Heap A (not garbage-collected storage) is a nearly complete binary tree.. Height of node = # of edges on a longest simple path from the node down to a leaf.. Height of heap

More information

L14 Quicksort and Performance Optimization

L14 Quicksort and Performance Optimization L14 Quicksort and Performance Optimization Alice E. Fischer Fall 2018 Alice E. Fischer L4 Quicksort... 1/12 Fall 2018 1 / 12 Outline 1 The Quicksort Strategy 2 Diagrams 3 Code Alice E. Fischer L4 Quicksort...

More information

Chapter 1 Divide and Conquer Algorithm Theory WS 2013/14 Fabian Kuhn

Chapter 1 Divide and Conquer Algorithm Theory WS 2013/14 Fabian Kuhn Chapter 1 Divide and Conquer Algorithm Theory WS 2013/14 Fabian Kuhn Divide And Conquer Principle Important algorithm design method Examples from Informatik 2: Sorting: Mergesort, Quicksort Binary search

More information

TRANSFORMATOARE DE CURENT

TRANSFORMATOARE DE CURENT MAK 140/80 TRANSFORMATOARE DE CURENT Aceste transformatoare de curent pot fi utilizate pentru curenţi de la 200 A la 2000 A. Ele sunt transformatoare de curent de tip inel. Sunt fabricate conform standardelor

More information

CSE 4/531 Solution 3

CSE 4/531 Solution 3 CSE 4/531 Solution 3 Edited by Le Fang November 7, 2017 Problem 1 M is a given n n matrix and we want to find a longest sequence S from elements of M such that the indexes of elements in M increase and

More information

Syllabus. 3. Sorting. specification

Syllabus. 3. Sorting. specification Introduction to Algorithms Syllabus Specification Bubble Sort Selection Sort Insertion Sort Merge Sort Quicksort Linear-Time Median Sorting in Linear Time Specification Primitives: semantics and cost Design

More information

COS 226 Midterm Exam, Spring 2009

COS 226 Midterm Exam, Spring 2009 NAME: login ID: precept: COS 226 Midterm Exam, Spring 2009 This test is 10 questions, weighted as indicated. The exam is closed book, except that you are allowed to use a one page cheatsheet. No calculators

More information

Introduction to Programming: Lecture 6

Introduction to Programming: Lecture 6 Introduction to Programming: Lecture 6 K Narayan Kumar Chennai Mathematical Institute http://www.cmi.ac.in/~kumar 28 August 2012 Example: initial segments Write a Haskell function initsegs which returns

More information

CSE 2123 Sorting. Jeremy Morris

CSE 2123 Sorting. Jeremy Morris CSE 2123 Sorting Jeremy Morris 1 Problem Specification: Sorting Given a list of values, put them in some kind of sorted order Need to know: Which order? Increasing? Decreasing? What does sorted order mean?

More information

Sorting Shabsi Walfish NYU - Fundamental Algorithms Summer 2006

Sorting Shabsi Walfish NYU - Fundamental Algorithms Summer 2006 Sorting The Sorting Problem Input is a sequence of n items (a 1, a 2,, a n ) The mapping we want is determined by a comparison operation, denoted by Output is a sequence (b 1, b 2,, b n ) such that: {

More information

SYLLABUS. 3 seminar/laboratory 3.4 Total hours in the curriculum Of which: 3.5 course

SYLLABUS. 3 seminar/laboratory 3.4 Total hours in the curriculum Of which: 3.5 course SYLLABUS 1. Information regarding the programme 1.1 Higher education Babes-Bolyai University institution 1.2 Faculty Mathematics and Informatics 1.3 Department Informatics 1.4 Field of study Informatics

More information

Compiladores Prof. Bruno Lopes Lista 1

Compiladores Prof. Bruno Lopes Lista 1 1. Coteje as etapas do processo de compilação. 2. Seja a seguinte BNF da linguagem Pascal. Compiladores 2016.2 Prof. Bruno Lopes Lista 1 program ::= program identifier ; uses declaration ; block. uses

More information

Algorithms Lab 3. (a) What is the minimum number of elements in the heap, as a function of h?

Algorithms Lab 3. (a) What is the minimum number of elements in the heap, as a function of h? Algorithms Lab 3 Review Topics covered this week: heaps and heapsort quicksort In lab exercises (collaboration level: 0) The in-lab problems are meant to be be solved during the lab and to generate discussion

More information

ZB4BG0 cap de selector Ø22, oprire în 3 poziţii, Ronis 455

ZB4BG0 cap de selector Ø22, oprire în 3 poziţii, Ronis 455 Fişă tehnică produs Caracteristici ZB4BG0 cap de selector Ø22, oprire în 3 poziţii, Ronis 455 Caracteristici Principale Gama de produse Tip produs sau componenta Nume scurt al dispozitivului Material rama

More information

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1 Solutions

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1 Solutions CSE 6 Introduction to igital Logic and Computer esign Exam Solutions Jonathan Turner /3/4. ( points) raw a logic diagram that implements the expression (B+C)(C +)(B+ ) directly (do not simplify first),

More information

4 LSI 2006/01/24/ F :

4 LSI 2006/01/24/ F : 4 SI 2006/01/24/ 035740F : 1 1.1 2bit Shift P C I IF ID E E WB 1: 2bit Shift P C I IF ID E E WB 2: 1 1.2 / 1: 00 add R1 R1 R2 01 add R4 R1 R3 02 sub R5 R1 R3 03 andi R6 R115 04 sw R1 R0 0 REST 00 IF ID

More information

Master in Bioingineria protezarii

Master in Bioingineria protezarii Master in Bioingineria protezarii Cursul: TEHNICI CAD/CAM Facultatea de Bioinginerie medicala, UMF Iasi Anul universitar 2010-2011 Modelarea 3D cu ajutorul volumelor În general, obiectele 3D pot fi construite

More information

IMPLEMENTATION METHOD "DIVIDE AND IMPERA" USING OBJECT -ORIENTED PROGRAMMING IN C #

IMPLEMENTATION METHOD DIVIDE AND IMPERA USING OBJECT -ORIENTED PROGRAMMING IN C # IMPLEMENTATION METHOD "DIVIDE AND IMPERA" USING OBJECT -ORIENTED PROGRAMMING IN C # PhD. Student engineer Cătălin LUPU Ministry of Administration and Interior, Suceava, Romania lupucata@yahoo.com Assoc.

More information

Issue with Implementing PrimeSieve() in Go

Issue with Implementing PrimeSieve() in Go Slices 02-201 Issue with Implementing PrimeSieve() in Go func PrimeSieve(n int) [n+1]bool { var iscomposite [n+1]bool //ERROR! biggestprime := 2 for biggestprime < n for i:=2; i

More information

{ -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '83 } { -- PASCAL PROGRAM SOLUTIONS }

{ -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '83 } { -- PASCAL PROGRAM SOLUTIONS } FHSCC '83 PASCAL PROGRAM SOLUTIONS 145 { -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '83 } { -- PASCAL PROGRAM SOLUTIONS } {1.1} program One1T83; { -- This program will round a number to nearest whole

More information

Introducere in AutoCAD 3D

Introducere in AutoCAD 3D Introducere in AutoCAD 3D Eu obisnuiesc sa spun ca diferenta dintre AutoCAD 2D si AutoCAD 3D este doar de 15 minute deoarece totul se reduce doar la a intelege cum functioneaza acest 3D si sistemul de

More information

Data Structures And Algorithms

Data Structures And Algorithms Data Structures And Algorithms Efficient Sorting Algorithms Eng. Anis Nazer First Semester 2017-2018 Efficient Sorting Simple sorting complexity Efficient sorting complexity O(n 2 ) O(nlg n) Merge sort

More information

Algorithms and Data Structures (INF1) Lecture 7/15 Hua Lu

Algorithms and Data Structures (INF1) Lecture 7/15 Hua Lu Algorithms and Data Structures (INF1) Lecture 7/15 Hua Lu Department of Computer Science Aalborg University Fall 2007 This Lecture Merge sort Quick sort Radix sort Summary We will see more complex techniques

More information

DIN EN ISO 14001:2009

DIN EN ISO 14001:2009 C E R T I F I C AT E Management system as per Evidence of conformity with the above standard(s) has been furnished and is certified in accordance with TÜV PROFiCERT procedures for TT ELECTRONICS SENSING

More information

Homework #3. CMSC351 - Spring 2013 PRINT Name :

Homework #3. CMSC351 - Spring 2013 PRINT Name : Homework #3 CMSC351 - Spring 2013 PRINT Name : Due: Mar 12 th at the start of class o Grades depend on neatness and clarity. o Write your answers with enough detail about your approach and concepts used,

More information

Quick Reference Guide

Quick Reference Guide SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Pascal language This reference guide

More information

COMP2012H Spring 2014 Dekai Wu. Sorting. (more on sorting algorithms: mergesort, quicksort, heapsort)

COMP2012H Spring 2014 Dekai Wu. Sorting. (more on sorting algorithms: mergesort, quicksort, heapsort) COMP2012H Spring 2014 Dekai Wu Sorting (more on sorting algorithms: mergesort, quicksort, heapsort) Merge Sort Recursive sorting strategy. Let s look at merge(.. ) first. COMP2012H (Sorting) 2 COMP2012H

More information

12 Dynamic Programming (2) Matrix-chain Multiplication Segmented Least Squares

12 Dynamic Programming (2) Matrix-chain Multiplication Segmented Least Squares 12 Dynamic Programming (2) Matrix-chain Multiplication Segmented Least Squares Optimal substructure Dynamic programming is typically applied to optimization problems. An optimal solution to the original

More information

Scop: Crearea unei aplicatii ce exemplifica paternul MVVM. In plus se creaza si o comanda in WPF.

Scop: Crearea unei aplicatii ce exemplifica paternul MVVM. In plus se creaza si o comanda in WPF. Laborator MVVM Scop: Crearea unei aplicatii ce exemplifica paternul MVVM. In plus se creaza si o comanda in WPF. Clasele implicate in acest pattern sunt date in figura de mai jos. Mai multe informatii

More information

14 Dynamic. Matrix-chain multiplication. P.D. Dr. Alexander Souza. Winter term 11/12

14 Dynamic. Matrix-chain multiplication. P.D. Dr. Alexander Souza. Winter term 11/12 Algorithms Theory 14 Dynamic Programming (2) Matrix-chain multiplication P.D. Dr. Alexander Souza Optimal substructure Dynamic programming is typically applied to optimization problems. An optimal solution

More information

Laborator 3 Aplicatii Java

Laborator 3 Aplicatii Java Laborator 3 Aplicatii Java 1. Programarea vizuala Scrieti, compilati si rulati toate exemplele din acest laborator: 1. Fisierul se numeste testschimbareculori.java: import java.awt.*; import java.awt.event.*;

More information