алгоритмы данных

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    long long k;

    cin >> n >> k;

    vector<long long> pref(n + 1, 0);

    for (int i = 1; i <= n; i++) {
        long long x;
        cin >> x;
        pref[i] = pref[i - 1] + x;
    }

    int ans = n;

    for (int i = 0; i < n; i++) {

        auto it = lower_bound(
            pref.begin() + i + 1,
            pref.end(),
            pref[i] + k
 

...

See on Student Notes »

Алгоритмы данных

#include ‹iostream>
using namespace std;
int main(){
int n;
cin >>n;
int a[100000];
for (int i=0; i‹n; i++)
cin ››a[i];
int x;
cin >>x;
int 1=0, r=n-1;
while (l<=r){
int m=(1+r)/2;
if (a[m]==x) {
cout «"Yes";
return 0;
}
if (a [m]<x)
l=m+1;
else
r=m-1;
}
cout «"No";
return 0;
}



#include <iostream>
using namespace std;

int main() {
    int n, q;
    cin >> n >> q;

    int a[100];

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    while (

...

See on Student Notes »

DAA cheating

Q1. State minimum cost spanning trees problem. Discuss Prim’s algorithm to solve this problem and state its running time.
Minimum Cost Spanning Tree (MCST/MST): Given a connected, weighted, undirected graph G=(V,E), a spanning tree connects all vertices using exactly |V|−1 edges and
contains no cycle. An MST is a spanning tree having minimum total edge weight: Cost(T)=Σ w(e), e∈T.
Prim’s Algorithm: A greedy algorithm that starts from any vertex and repeatedly adds the minimum-weight edge
...

See on Student Notes »

dsaddas

Regole di Scoping A cosa servono: Determinano a quale dichiarazione si riferisce una variabile non locale (libera) usata in un blocco o funzione.Tipi: Possono essere statiche (basate sulla struttura testuale del codice) o dinamiche (basate sulla catena delle chiamate).Regole di BindingA cosa servono: Servono a stabilire quale ambiente usare quando una funzione con variabili non locali viene passata come parametro a un'altra. Con lo scoping statico il problema non si pone (vale sempre l'ambiente

...

See on Wikiteka »

SESSIONAL (PPE)

Q.1.Explain Draught system.

Ans:- Draught System in Thermal Power Plant:- 

1)Draught is the pressure difference that causes the flow of air into the furnace and flue gases out of the boiler.

2)Its main purpose is to supply sufficient oxygen for proper combustion of fuel and remove the resulting flue gases.

3)Natural Draught: It is produced by a tall chimney due to the difference in density between hot flue gases and outside air.

4)Forced Draught: A forced-draught (FD) fan forces fresh air into

...

See on Student Notes »

Altair Cheatsheet

Altair Cheat Sheet Python

01 Build a chart


1. Import + general pattern

import altair as alt
chart = (
    alt.Chart(data).mark_...()
    .encode(x=..., y=..., color=...)
    .transform_...(...).properties(...)
    .interactive()
)

2. Choose a chart type

mark_bar   bars / aggregated comparison
mark_line   trends over an ordered axis
mark_circle   scatter plots
mark_area   filled trends / totals
mark_rect   heat maps
mark_arc   pie or donut charts
mark_boxplot   distribution summaries
mark_geoshape

...

See on Student Notes »

leb exam

Module 1: Basic distinctions

Term Remember it as
Common law Rules developed through court decisions
Statutory law Written laws passed by a legislature
Federal / state law Which level of government the law comes from
Plaintiff / defendant Person suing / person being sued
Civil / criminal A claim for a remedy, often damages / government prosecution for a crime
Law / ethics What is legally required / what someone believes is right

Proof standards: Civil case = preponderance of...

See on Student Notes »

it sem2

1.A Computer is an electronic machine that can store, process, & display data. It helps in performing different tasks like calculations, writing, & browsing.

2. System software is a type of software that helps the computer work properly. It controls & manages the hardware & basic functions, like the operating system.

3. Application software is a program designed 2 help users perform specific tasks, like writing documents, playing games, or editing photos.

4. Free & open software

...

See on Student Notes »

data analytics

Q1. Explain Regression Modeling. Discuss Linear and Multiple Regression.

1. Definition

Regression modeling is a statistical technique used to study the relationship between a dependent variable and one or more independent variables. It is mainly used for prediction and estimating relationships between variables.

2. Simple Linear Regression

It uses one independent variable.

Y=β0+β1X+ϵ

where:

  • Y = dependent variable
  • X = independent variable
  • β0 = intercept
  • β1 = regression coefficient
  • ϵ = error
...

See on Student Notes »