---
# System prepended metadata

title: Vaishali Bhoyar

---

# Vaishali Bhoyar

# Question 1 - MergeSort
```javascript=


function merge(arr,mid,l,h){
    let merged=[];
    let k=0;
    let i=l;
    let j=mid+1
    while(i<=mid && j<=h){
        if(arr[i]<=arr[j]){
            merged[k++]= arr[i++];
        }
        else{
            merged[k++]=arr[j++];
        }
    }
    while(i<=mid){
        merged[k++]=arr[i++];
    }
    while(j<=h){
        merged[k++]=arr[j++];
    }
    for(let i=0,j=l; i<merged.length; i++, j++){
        arr[j]=merged[i];
    }
}

function divide(arr,l,h){
    if(l>=h){
        return;
    }
    let mid = Math.floor(l+((h-l)/2));
    divide(arr,l,mid);
    divide(arr,mid+1,h);
    merge(arr,mid,l,h);
}


```

# Question 2: 
```javascript=
const studentArr = [
    { age: 10, name: 'Payal1', section: 'A'},
    { age: 10, name: 'Payal2', section: 'A'},
    { age: 11, name: 'Payal3', section: 'A'},
    { age: 10, name: 'Payal4',  section: 'B'}
]
// students whoes age >=12
let students = studentArr.filter((elem)=>{
    if(elem.age>=12){
        return elem.name;
    }
})

// { 'Payal1': 10, 'Payal2': 11, 'Payal3': 12, 'Payal4': 13,  }
let obj = {};
studenArr.forEach((elem)=>{
    obj[elem.name]=elem.age;
});


{
    A: {
        10: ['Payal1', 'Payal2'],
        11: ['Payal3']
    },
    B: {
        10: ['Payal4']
    }
}

function data(arr){
    let obj={};
    arr.forEach((elem)=>{
        if(obj[elem.section]===undefined){
            obj[elem.section]={};
        }
    })
    studentArr.forEach((elem)=>{
        for(let key in obj){
            if(key === elem.section){
                if(obj[key][elem.age]===undefined){
                    obj[key][elem.age]=[elem.name];
                }
                else{
                    obj[key][elem.age].push(elem.name);
                }
            }
        }
    })
    return obj;
}

```

# Question 3: 
